Python solution. Easy to understand


  • 0
            p = 0
            for i in s:
                if i in t[p:]:
                    a = t.find(i,p)
                    p = a+1
                else: 
                    return False
            return True
    
    
    

Log in to reply
 

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