Time O(n) Space O(1) Python3 solution
\n\nclass Solution:\n    def prefixesDivBy5(self, A: List[int]) -> List[bool]:\n        # time O(n)\n        # space O(1)\n        output = []\n        last_bit
\n```\nclass Solution:\n    def prefixesDivBy5(self, A: List[int]) -> List[bool]:\n        # time O(n)\n        # space O(1)\n        output = []\n        last_bit = 0\n        for i in range(len(A)):\n            new_bit = last_bit*2 + A[i]\n            output.append(new_bit % 5 == 0)\n            last_bit = new_bit\n        return output\n```
['Python', 'Python3']