amazon oa

This commit is contained in:
2024-05-28 16:33:16 +02:00
parent 9104fd9842
commit cd42299e73
3 changed files with 52 additions and 0 deletions

18
392-240527-pass/main.py Normal file
View File

@@ -0,0 +1,18 @@
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
cnt = 0
idt_m = 0
for idx, chs in enumerate(s):
for idt, cht in enumerate(t[idt_m:]):
if cht == chs:
idt_m = idt + idt_m + 1
cnt += 1
print(idt_m, idt, cht)
break
if cnt == len(s): return True
return False
sol = Solution()
s = "axc"
t = "ahbgdc"
print(sol.isSubsequence(s,t))