Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class Solution {
  2. public:
  3. bool isSubsequence(string s, string t) {
  4. int j = 0;
  5. if(s.size()==0)
  6. return true;
  7. for(int i=0;i<t.size();i++){
  8. if(s[j]==t[i]){
  9. //cout<<s[j]<<" ";
  10. if(j==s.length()-1)
  11. return true;
  12. j++;
  13. }
  14. else{
  15. continue;
  16. }
  17. }
  18. return false;
  19. }
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement