파비의 매일매일 공부기록

2023.09.22 Today's Challenge 본문

Problem Solving/LeetCode

2023.09.22 Today's Challenge

fabichoi 2023. 9. 22. 23:45

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

 

LeetCode - The World's Leading Online Programming Learning Platform

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:
    def isSubsequence(self, s: str, t: str) -> bool:
        i, j = 0, 0
        while i < len(s) and j < len(t):
            if s[i] == t[j]:
                i += 1
            j += 1
        return i == len(s)
반응형

'Problem Solving > LeetCode' 카테고리의 다른 글

2023.09.24 Today's Challenge  (0) 2023.09.24
2023.09.23 Today's Challenge  (0) 2023.09.23
2023.09.21 Today's Challenge  (0) 2023.09.21
2023.09.20 Today's Challenge  (0) 2023.09.20
2023.09.19 Today's Challenge  (0) 2023.09.19
Comments