노력에는 지름길이 없으니까요

LeetCode - 1967. Number of Strings That Appear as Substrings in Word 본문

Python/프로그래머스

LeetCode - 1967. Number of Strings That Appear as Substrings in Word

데건 2024. 9. 13. 22:50
728x90

 

해결일 언어 레벨 테스트명
20240913 Python easy  1967. Number of Strings That Appear as Substrings in Word

 

링크 : https://leetcode.com/problems/number-of-strings-that-appear-as-substrings-in-word/

 

 

 


 

내 코드

class Solution:
    def numOfStrings(self, patterns: List[str], word: str) -> int:
        ans = 0
        for pattern in patterns :
            if pattern in word:
                ans += 1
        return ans

 

 

문자열이 부분일치하는 지 확인하려면 in을 사용하면 된다.

728x90
반응형