Skip to content

Commit

Permalink
Merge pull request sashaaero#13 from manbhasin/master
Browse files Browse the repository at this point in the history
leet_392 py file
  • Loading branch information
sashaaero committed Oct 10, 2019
2 parents fb26672 + 1ae1e75 commit b19333b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions leet_392.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#https://leetcode.com/problems/is-subsequence/
# Runtime 24.23 ms


def isSubSequence(s, t, m, n):
if m == 0:
return True
if n == 0:
return False
if s[m - 1] == t[n - 1]:
return isSubSequence(s, t, m - 1, n - 1)

return isSubSequence(s, t, m, n - 1)


s = input()
t = input()

if isSubSequence(s, t, len(s), len(t)):
print('TRUE')
else:
print('FALSE')

0 comments on commit b19333b

Please sign in to comment.