mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-25 12:14:26 +08:00
Add solution 1018
This commit is contained in:
@ -0,0 +1,10 @@
|
||||
package leetcode
|
||||
|
||||
func prefixesDivBy5(a []int) []bool {
|
||||
res, num := make([]bool, len(a)), 0
|
||||
for i, v := range a {
|
||||
num = (num<<1 | v) % 5
|
||||
res[i] = num == 0
|
||||
}
|
||||
return res
|
||||
}
|
Reference in New Issue
Block a user