Leetcode Note: Go - Count the Number of Consistent Strings
Count the Number of Consistent Strings - LeetCode
https://leetcode.com/problems/count-the-number-of-consistent-strings/
- Go 言語で取り組んだメモ
回答
[Java][Golang] Using o(n^2) and easy you understand - Count the Number of Consistent Strings - LeetCode
https://leetcode.com/problems/count-the-number-of-consistent-strings/solutions/2799518/java-golang-using-o-n-2-and-easy-you-understand/
func countConsistentStrings(allowed string, words []string) int {
count := 0
for _, s := range words {
for i, v := range s {
if strings.Contains(allowed, string(v)) == false {
break
}
if i == len(s)-1 {count++}
}
}
return count
}