All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : July 04, 2024
Last updated : July 04, 2024
Related Topics : Array, Bit Manipulation
Acceptance Rate : 46.82 %
class Solution:
def prefixesDivBy5(self, nums: List[int]) -> List[bool]:
output = []
curr = 0
for num in nums :
curr = (2 * curr + num) % 5
output.append(curr == 0)
return output