Skip to content

Commit eee4d89

Browse files
authored
Merge pull request #1947 from laitooo/0392-is-subsequence.dart
Create: 0392-Is-Subseqyence.dart
2 parents 60bee98 + 89343e5 commit eee4d89

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: dart/0392-is-subsequence.dart

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
bool isSubsequence(String s, String t) {
3+
int i = 0, j = 0;
4+
while (i < t.length && j != s.length) {
5+
if (t[i] == s[j]) {
6+
j += 1;
7+
}
8+
i += 1;
9+
}
10+
return j == s.length;
11+
}
12+
}

0 commit comments

Comments
 (0)