Skip to content

Instantly share code, notes, and snippets.

@ChrisXu
Last active December 7, 2016 07:00
Show Gist options
  • Save ChrisXu/ea259f3136c6dd32523fc7ed3aac9152 to your computer and use it in GitHub Desktop.
Save ChrisXu/ea259f3136c6dd32523fc7ed3aac9152 to your computer and use it in GitHub Desktop.
def isSubsequence(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
if len(s) > len(t):
return False
k = 0
for i in xrange(0,len(s)):
s_c = s[i]
for j in xrange(k,len(t)):
t_c = t[j]
if j == len(t) - 1 and i < len(s) - 1:
return False
if s_c == t_c:
k = j + 1
break
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment