Skip to content

Instantly share code, notes, and snippets.

@Siyu-Lei
Created May 27, 2018 03:57
Show Gist options
  • Save Siyu-Lei/32a9629658c56271753a64619961259a to your computer and use it in GitHub Desktop.
Save Siyu-Lei/32a9629658c56271753a64619961259a to your computer and use it in GitHub Desktop.
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