Created
October 6, 2024 17:32
-
-
Save mohneesh7/d71ecadfd28117b62597673c35b22d9b to your computer and use it in GitHub Desktop.
Solution for Is Subsequence
This file contains hidden or 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
# Solution for Is Subsequence | |
class Solution: | |
def isSubsequence(self, s: str, t: str) -> bool: | |
if s == '': | |
return True | |
s_list = list(s) | |
for char in t: | |
if s_list != [] and char == s_list[0]: | |
s_list.pop(0) | |
if s_list == []: | |
return True | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment