392. Is Subsequence

알고리즘 문제풀기 · 2019. 11. 27. 12:51

https://leetcode.com/problems/is-subsequence/

 

Is Subsequence - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

class Solution(object):  
    def isSubsequence(self, s, t):  
        """  
        :type s: str  
        :type t: str  
        :rtype: bool  
        """  

        count = 0  

        for i in range(0, len(t), 1):  

            if count < len(s) and s[count] == t[i]:  
                count+=1  

        if count == len(s):  
            return True  
        else:  
            return False

'알고리즘 문제풀기' 카테고리의 다른 글

1048. Longest String Chain  (0) 2019.12.05
1219. Path with Maximum Gold  (0) 2019.12.04
988. Smallest String Starting From Leaf  (0) 2019.11.28
792. Number of Matching Subsequences  (0) 2019.11.27
946. Validate Stack Sequences  (0) 2019.11.26