This commit is contained in:
parent
4ee9bc38cb
commit
bf2f9a145f
1 changed files with 11 additions and 0 deletions
11
easy/is_subsequence.py
Normal file
11
easy/is_subsequence.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# https://leetcode.com/problems/is-subsequence
|
||||||
|
class Solution:
|
||||||
|
def isSubsequence(self, s: str, t: str) -> bool:
|
||||||
|
length = len(s)
|
||||||
|
index = 0
|
||||||
|
for c in t:
|
||||||
|
if index >= length:
|
||||||
|
break
|
||||||
|
if s[index] == c:
|
||||||
|
index += 1
|
||||||
|
return index >= length
|
||||||
Loading…
Add table
Add a link
Reference in a new issue