Easy Python Solution


  • 0
    M
    class Solution(object):
        def isSubsequence(self, s, t):
            if(s == ""): return True
            i = 0
            j = 0
            while ( i<len(s) and j< len(t)):
                if(s[i] == t[j]):
                    i+=1
                    j+=1
                else:
                    j+=1    
            return i == len(s) 
    

Log in to reply
 

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