leetcode——392. 判断子序列

简单题,一次完成。

class Solution:
    def isSubsequence(self, s: str, t: str) -> bool:
        if len(t)<len(s):
            return False
        i=0
        while i<len(s):
            if s[i] in t:
                d=t.index(s[i])
                t=t[d+1:]
                i+=1
            else:
                return False
        return True
执行用时 :52 ms, 在所有 python3 提交中击败了93.21%的用户
内存消耗 :18.1 MB, 在所有 python3 提交中击败了5.26%的用户
 
                                                          ——2019.10.16
posted @ 2019-10-16 17:35  欣姐姐  阅读(159)  评论(0编辑  收藏  举报