Leetcode Note: Go - Count Prefixes of a Given String
Count Prefixes of a Given String - LeetCode
https://leetcode.com/problems/count-prefixes-of-a-given-string/
- Go 言語で取り組んだメモ
回答
Count Prefixes of a Given String - LeetCode
https://leetcode.com/problems/count-prefixes-of-a-given-string/solutions/3510031/go-0-ms-100-3-7-mb-83-67/
func countPrefixes(words []string, s string) int {
	var res int
	for _, v := range words {
		if strings.HasPrefix(s, v) {
			res++
		}
	}
	return res
}