When I am submitting the following solution
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
li = []
i = 0
for ch in t:
if ch == s[i]:
i+=1
#debug
li.append(ch)
if s == ''.join(li):
return "true"
else:
return "false"
in leetcode, solution is failing because it it shows ouput being true as can be seen here. But output for this testcase on my mahcine is false which is correct and expected ouput. I have tried finding solution for this on various forums and already tried all the recommened solution provided by this post by leetcode but it is also not working.
The test case for which solution is failing:
"axc"
"ahbgdc"
Question can be found here on leetcode