This commit is contained in:
2025-11-24 14:51:42 +08:00
parent e921762ca4
commit e030df06c9
3 changed files with 15 additions and 32 deletions

8
25/11/1018.py Normal file
View File

@@ -0,0 +1,8 @@
class Solution:
def prefixesDivBy5(self, nums: List[int]) -> List[bool]:
ans = []
num = 0
for v in nums:
num = ((num << 1) + v) % 5
ans.append(num == 0)
return ans

View File

@@ -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
}