Skip to content

Commit 2cfa986

Browse files
solves is sub sequence
1 parent 6f12a64 commit 2cfa986

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/IsSubsequence.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class IsSubsequence {
2+
public boolean isSubsequence(String s, String t) {
3+
int j = 0;
4+
for (int index = 0 ; index < t.length() && j < s.length() ; index++) {
5+
if (s.charAt(j) == t.charAt(index)) {
6+
j++;
7+
}
8+
}
9+
return j == s.length();
10+
}
11+
}

0 commit comments

Comments
 (0)