simple solution O(N) time complexity O(1) Space
\tclass Solution(object):\n\tdef threeEqualParts(self, A):\n        if len(A) < 3:\n            return [-1,-1]\n        nums = 0\n        for i in range(len(A))
\tclass Solution(object):\n\tdef threeEqualParts(self, A):\n        if len(A) < 3:\n            return [-1,-1]\n        nums = 0\n        for i in range(len(A)):\n            if A[i] == 1:\n                nums += 1\n        \n        if nums % 3 != 0:\n            return [-1,-1]\n        \n        if nums == 0:\n            return [0,len(A) - 1]\n        arr = []\n        val = 0\n        \n\n        for i in range(len(A)):\n            if A[i] == 1:\n                val += 1\n                if val == 1 or val == nums/3 or val == nums/3 + 1 or val == 2*nums/3 or val == 2*nums/3 + 1 or val == nums:\n                    arr.append(i)\n        if nums == 3:\n            z = len(A) - arr[2] - 1\n            x = arr[1] - arr[0] - 1\n            y = arr[2] - arr[1] - 1\n            if x < z or y < z:\n                return [-1,-1]\n            \n            return [arr[0] + z, arr[1] + z + 1]\n            \n        if A[arr[0]:arr[1]] != A[arr[2]:arr[3]] or A[arr[0]:arr[1]] != A[arr[4]:arr[5]]:\n            return [-1,-1]\n        \n        z = len(A) - arr[5] - 1\n        x = arr[2] - arr[1] - 1\n        y = arr[4] - arr[3] - 1\n        \n        if x < z or y < z:\n            return [-1,-1]\n\n        return [arr[1] + (len(A) - arr[5]) - 1, arr[3] + (len(A) - arr[5])]
[]