Leetcode Note: Go - Number of Strings That Appear as Substring in Word

Number of Strings That Appear as Substrings in Word - LeetCode
https://leetcode.com/problems/number-of-strings-that-appear-as-substrings-in-word/

  • Go 言語で取り組んだメモ

回答

Golang Solution - Number of Strings That Appear as Substrings in Word - LeetCode
https://leetcode.com/problems/number-of-strings-that-appear-as-substrings-in-word/solutions/3401681/golang-solution/

func numOfStrings(patterns []string, word string) int {
    count := 0
    for _, s := range patterns {
        if strings.Contains(word, s) {
            count++
        }
    }
    return count
}