22- Is Subsequence
My Approach
Time and Auxiliary Space Complexity
Code (C++)
class Solution {
public:
bool isSubsequence(string s, string t) {
int i = 0;
for (auto& x : t) {
if (x == s[i]) i++;
}
return (i == s.size() ? true : false);
}
};
Contribution and Support
Last updated