mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-01-12 18:08:38 +08:00
1018
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package D
|
||||
|
||||
func prefixesDivBy5(nums []int) []bool {
|
||||
|
||||
ans := make([]bool, len(nums))
|
||||
num := 0
|
||||
for i, v := range nums {
|
||||
num = ((num << 1) + v) % 5
|
||||
ans[i] = num == 0
|
||||
}
|
||||
return ans
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user