My concise solution with explanation; beat 100%
Please upvote if you like it.\n\nObservations/algorithm:\n1. Each part must have equal number of 1\'s.\n2. Let nums be the actual binary value of the parts, the
*Please upvote if you like it.*\n\n**Observations/algorithm**:\n1. Each part must have equal number of 1\'s.\n2. Let nums be the actual binary value of the parts, then num1 == num2 == num3, and each num starts with a 1. The only exception is when all nums are 0.\n3. Each part can have various number of leading 0\'s.\n    Thus, part1/num1 and part2/num2 are more flexible: they can play with the leading 0\'s of the next part.\n\n4. num3 can be certain (if it exists), we find num3 by the following method:\n\t```\n            i             j       k\n    0000[num1]000000[num2]0000000[num3]\n\t```\n\n    Let find k first, where k is the first \'1\' we can find in part3 from left to right.\n    Then A[k:] is num3, let\'s call it pattern.\n    How to find k then? The 1\'s in num3 is one third of the total 1\'s.\n5. There must not be any 1\'s between any two nums.\n    So we scan from left to k-1, once we see a 1, it must belong to num1 and num1 must equal to pattern.\n    Assume num1 matched, we continue scanning, once we see another 1, it must belong to num2 and num2 must equal to pattern.\n    If num2 == pattern, then we are done; there won\'t be any 1\'s between num2 and num3 because the totle 1\'s are all visited in this round.\n\nCode:\n```\nclass Solution:\n    def threeEqualParts(self, A):\n        N = len(A)\n        ones = sum(A)\n        if ones == 0: return [0, N-1]\n        if ones % 3 > 0: return [-1, -1]\n        one_third = ones//3\n        k = N-1\n        while True:\n            if A[k] == 1:\n                ones -= 1\n                if ones == 2 * one_third: break\n            k -= 1\n        pattern = A[k:]\n        M = len(pattern)\n        \n        i = j = None\n        x = 0\n        while x < k:\n            if A[x] == 1:\n                if A[x:x+M] != pattern: return [-1, -1]\n                x += M\n                if i is None: i = x - 1\n                else: j = x\n            else:\n                x += 1\n        return [i, j]\n```\n\nComplexity Analysis:\n* Running Time: O(N), two passes\n* Space: O(N) for storing and comparing pattern
[]