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

Chobby·2일 전
1

LeetCode

목록 보기
640/650

😎풀이

  1. patterns 순회
    1-1. 각 패턴이 word에 속해있는지 검사
  2. word에 속해있는 pattern의 수 반환
function numOfStrings(patterns: string[], word: string): number {
    let result = 0
    for(const pattern of patterns) {
        if(word.includes(pattern)) result++
    }
    return result
};
profile
내 지식을 공유할 수 있는 대담함

0개의 댓글