Skip to content

Commit c688c76

Browse files
Sapna SharmaSapna Sharma
Sapna Sharma
authored and
Sapna Sharma
committed
Easy
1 parent 9f06cde commit c688c76

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

392.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#392
2+
class Solution(object):
3+
def isSubsequence(self, s, t):
4+
"""
5+
:type s: str
6+
:type t: str
7+
:rtype: bool
8+
"""
9+
if len(s) == 0:
10+
return True
11+
i,j = 0,0
12+
l = len(t)
13+
m=0
14+
while l>0:
15+
if s[i] == t[j]:
16+
i+=1
17+
j+=1
18+
l-=1
19+
m+=1
20+
else:
21+
j+=1
22+
l-=1
23+
if m == len(s):
24+
return True
25+
return False

0 commit comments

Comments
 (0)