Is Subsequence(392)

3368 단어 LeetCode1LeetCode1

String - Easy

class Solution:
    def isSubsequence(self, s: str, t: str) -> bool:
        length = len(s)
        
        if length == 0:
            return True
        
        queue = deque(list(s))
        target = list(t)
        
        
        for i in range(len(target)):
            if len(queue) != 0 and target[i] == queue[0]:
                queue.popleft()
                
        if len(queue) == 0:
            return True
        else:
            return False
             

좋은 웹페이지 즐겨찾기