forked from sashaaero/LeetCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request sashaaero#13 from manbhasin/master
leet_392 py file
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |