add new solutions
This commit is contained in:
parent
ca24d0a56a
commit
0c73608ce5
36 changed files with 791 additions and 0 deletions
15
solutions/10/q1018/solution.go
Normal file
15
solutions/10/q1018/solution.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package q1018
|
||||
|
||||
func prefixesDivBy5(nums []int) []bool {
|
||||
ret := make([]bool, len(nums))
|
||||
|
||||
num := 0
|
||||
for i, n := range nums {
|
||||
num = num<<1 + n
|
||||
ret[i] = num%5 == 0
|
||||
num %= 5
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
var _ = prefixesDivBy5
|
||||
Loading…
Add table
Add a link
Reference in a new issue