Guest User

Untitled

a guest
Apr 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class Solution {
  2. public boolean isSubsequence(String s, String t) {
  3. if (s == null || s.length() == 0) return true;
  4. int i = 0;
  5. int j = 0;
  6.  
  7. while (i < s.length() && j < t.length()) {
  8. if (s.charAt(i) == t.charAt(j)) {
  9. i++;
  10.  
  11. if (i == s.length()) return true;
  12. }
  13.  
  14. j++;
  15. }
  16.  
  17. return false;
  18. }
  19. }
Add Comment
Please, Sign In to add comment