Created
May 27, 2018 03:57
-
-
Save Siyu-Lei/32a9629658c56271753a64619961259a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public boolean isSubsequence(String s, String t) { | |
for (int i = 0, pos = 0; i < s.length(); i++, pos++) { | |
pos = t.indexOf(s.charAt(i), pos); | |
if (pos == -1) return false; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment