[Python] O(n) Straightforward Solution
The solution is inspired by this Logical Thinking.\n\n\nclass Solution:\n    def threeEqualParts(self, A: List[int]) -> List[int]:\n        \n        num_ones =
The solution is inspired by this [Logical Thinking](https://leetcode.com/problems/three-equal-parts/discuss/250203/Logical-Thinking).\n\n```\nclass Solution:\n    def threeEqualParts(self, A: List[int]) -> List[int]:\n        \n        num_ones = sum(A)\n        \n        if num_ones == 0:\n            return [0, 2]\n        \n        if num_ones % 3 != 0:\n            return [-1, -1]\n        \n        c = 0\n        s1 = s2 = s3 = -1\n        for idx,x in enumerate(A):\n\t\t\t# Find the first 1 in each part\n            if x == 1:\n                c += 1\n            \n            if c == 1 and s1 < 0:\n                s1 = idx\n                \n            if c == num_ones//3 + 1 and s2 < 0:\n                s2 = idx\n                \n            if c == num_ones*2//3 + 1 and s3 < 0:\n                s3 = idx\n                break\n                \n        n = len(A[s3:]) # The length of each part when all the leading 0\'s are removed\n        \n        if A[s1:s1+n] == A[s2:s2+n] and A[s2:s2+n] == A[s3:]:\n            return [s1+n-1, s2+n]\n        else:\n            return [-1, -1]\n```\n\n
[]