A simple python solution


  • 0
    W
    class Solution(object):
        def isSubsequence(self, s, t):
            """
            :type s: str
            :type t: str
            :rtype: bool
            """
            ls = list(s)
            for i in t:
                if (ls and i == ls[0]):
                    ls.pop(0)
            if (ls):
                return False
            else:
                return True
    

Log in to reply
 

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