MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / isSubsequence

Method isSubsequence

392-is-subsequence/is-subsequence.py:2–14  ·  view source on GitHub ↗
(self, s: str, t: str)

Source from the content-addressed store, hash-verified

1class Solution:
2 def isSubsequence(self, s: str, t: str) -> bool:
3 i=0
4 # j=0
5 if s=="":
6 return True
7 for j in range(len(t)):
8
9 if s[i]==t[j]:
10 i+=1
11 if i==len(s):
12 return True
13
14 return False

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected