[Python] Calculate Prefix Mod
Solution 1\npy\n    def prefixesDivBy5(self, A):\n        for i in xrange(1, len(A)):\n            A[i] += A[i - 1] * 2 % 5\n        return [a % 5 == 0 for a in
# Solution 1\n```py\n    def prefixesDivBy5(self, A):\n        for i in xrange(1, len(A)):\n            A[i] += A[i - 1] * 2 % 5\n        return [a % 5 == 0 for a in A]\n```\n`O(1)` space\n```\n    def prefixesDivBy5(self, A):\n        sums = 0\n        for i, a in enumerate(A):\n            sums = sums * 2 % 5 + a\n            A[i] = sums % 5 == 0\n        return A\n```\n<br>\n\n# Solution 2: 1 line using accumulate\n**Python3**\n```py\n    def prefixesDivBy5(self, A):\n        return [x % 5 == 0 for x in accumulate(A, lambda x, y: (x << 1) + y)]\n```\n\n
[]