Skip to content

Commit 7e6dbaf

Browse files
authored
Add files via upload
1 parent e1de42e commit 7e6dbaf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

392.Is Subsiquence.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
bool isSubsequence(string s, string t) {
4+
int sPtr = 0;
5+
int tPtr = 0;
6+
7+
while (sPtr < s.length() && tPtr < t.length()) {
8+
if (s[sPtr] == t[tPtr]) {
9+
sPtr++;
10+
}
11+
tPtr++;
12+
}
13+
return sPtr == s.length();
14+
}
15+
};

0 commit comments

Comments
 (0)