Skip to content

Instantly share code, notes, and snippets.

@0bach0
Last active February 16, 2020 15:52
Show Gist options
  • Save 0bach0/88e06f5439dd485f9937f78c32d85b31 to your computer and use it in GitHub Desktop.
Save 0bach0/88e06f5439dd485f9937f78c32d85b31 to your computer and use it in GitHub Desktop.
package jp.vietpro.vta;
public class SubSequence {
public static boolean isSubsequence(String s, String t) {
if(s.length()==0)
return true;
int sI=0;
for (int tI=0; tI < t.length(); tI++ ){
if (t.charAt(tI) == s.charAt(sI)){
sI++;
}
if(sI >= s.length()){
return true;
}
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment