Python the Fastest solution

  • 0
    class Solution:
        def isSubsequence(self, s, t):
            :type s: str
            :type t: str
            :rtype: bool
            min_index = 0
            for e in s:
                i = t.find(e, min_index)
                if i == -1:
                    return False
                min_index = i + 1
            return True

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.