# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param S string字符串 # @param T string字符串 # @return bool布尔型 # class Solution: def isSubsequence(self , S: str, T: str) -> bool: s1 = 0 t1 = 0 ind = 0 while t1 < len(T):#t指针遍历所有的T if S[s1] == T[t1]: s1 += 1#如果s指针和t指针的一致,s指针右移 if s1 == len(S):#如果s指针遍历完了S return True t1 += 1#t指针右移 return False#不是子序列