add new solutions
This commit is contained in:
parent
ca24d0a56a
commit
0c73608ce5
36 changed files with 791 additions and 0 deletions
25
solutions/19/q1935/solution.go
Normal file
25
solutions/19/q1935/solution.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package q1935
|
||||
|
||||
import "strings"
|
||||
|
||||
func canBeTypedWords(text string, brokenLetters string) int {
|
||||
var possible = 0
|
||||
broken := [26]bool{}
|
||||
for i := range brokenLetters {
|
||||
broken[brokenLetters[i]-'a'] = true
|
||||
}
|
||||
|
||||
Outer:
|
||||
for _, w := range strings.Fields(text) {
|
||||
for i := range w {
|
||||
if broken[w[i]-'a'] {
|
||||
continue Outer
|
||||
}
|
||||
}
|
||||
possible++
|
||||
}
|
||||
|
||||
return possible
|
||||
}
|
||||
|
||||
var _ = canBeTypedWords
|
||||
Loading…
Add table
Add a link
Reference in a new issue