We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef199bb commit 16097e3Copy full SHA for 16097e3
392. Is Subsequence
@@ -0,0 +1,29 @@
1
+Runtime 0 ms
2
+Beats 100%
3
+
4
5
+Memory 40.2 MB
6
+Beats 80.22%
7
8
9
+class Solution {
10
+ public boolean isSubsequence(String s, String t) {
11
+ char[]T = t.toCharArray();
12
+ char[]S = s.toCharArray();
13
+ int m = T.length, n = S.length;
14
15
+ if(n==0)
16
+ return true;
17
18
+ int s_ptr=0;
19
+ for(int i=0;i<m;i++){
20
+ if(S[s_ptr]==T[i])
21
+ s_ptr++;
22
+ if(s_ptr==n)
23
24
+ }
25
26
+ return false;
27
28
29
+}
0 commit comments