双指针判断
#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
#
# @param S string字符串
# @param T string字符串
# @return bool布尔型
#
class Solution:
def isSubsequence(self , S: str, T: str) -> bool:
# write code here
si = ti = 0
while ti < len(T):
if T[ti] == S[si]:
si += 1
if si == len(S):
return True
ti += 1
return False