Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 832 Bytes

_1018. Binary Prefix Divisible By 5.md

File metadata and controls

36 lines (26 loc) · 832 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : July 04, 2024

Last updated : July 04, 2024


Related Topics : Array, Bit Manipulation

Acceptance Rate : 46.82 %


Solutions

Python

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