Skip to content

Commit c029a07

Browse files
authored
Create Solution.java
1 parent 865bd48 commit c029a07

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public boolean isSubsequence(String s, String t) {
3+
int index = -1;
4+
for (char c : s.toCharArray()) {
5+
index = t.indexOf(c, index + 1);
6+
if (index == -1) {
7+
return false;
8+
}
9+
}
10+
return true;
11+
}
12+
}

0 commit comments

Comments
 (0)