Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- bool isSubsequence(string s, string t) {
- int j = 0;
- if(s.size()==0)
- return true;
- for(int i=0;i<t.size();i++){
- if(s[j]==t[i]){
- //cout<<s[j]<<" ";
- if(j==s.length()-1)
- return true;
- j++;
- }
- else{
- continue;
- }
- }
- return false;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement