Last active
February 16, 2020 15:52
-
-
Save 0bach0/88e06f5439dd485f9937f78c32d85b31 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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