Skip to content

Commit bf376f0

Browse files
committed
solved: 392. Is Subsequence
Signed-off-by: rajput-hemant <[email protected]>
1 parent ab86a5f commit bf376f0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
impl Solution {
2+
pub fn is_subsequence(s: String, t: String) -> bool {
3+
let (mut i, mut j) = (0, 0);
4+
5+
while i < s.len() && j < t.len() {
6+
if s.as_bytes()[i] == t.as_bytes()[j] {
7+
i += 1;
8+
}
9+
j += 1;
10+
}
11+
12+
i == s.len()
13+
}
14+
}

0 commit comments

Comments
 (0)