[Python] intuitive solution, less than 100% memory usage
\nclass Solution(object):\n    def threeEqualParts(self, A):\n        """\n        :type A: List[int]\n        :rtype: List[int]\n        """\n        N = len(A
```\nclass Solution(object):\n    def threeEqualParts(self, A):\n        """\n        :type A: List[int]\n        :rtype: List[int]\n        """\n        N = len(A)\n        if N < 3:\n            return [-1, -1]\n\n        count_of_one = A.count(1)\n        if count_of_one == 0:\n            return [0, N-1]\n        if count_of_one % 3 != 0:\n            return [-1, -1]\n\n        pattern = \'\'\n        count = 0\n        reversed_str = \'\'.join(map(str, A[::-1]))\n\n        for i, digit in enumerate(A[::-1]):\n            if digit == 1:\n                count += 1\n            if count == count_of_one/3:\n                break\n        pattern = reversed_str[:i+1]\n\n        length = len(reversed_str)\n        len_pattern = len(pattern)\n\n        \'\'\'matching\'\'\'\n        index = reversed_str.find(pattern, len_pattern)\n        if index == -1:\n            return [-1, -1]\n        j = length - index\n\n        index = reversed_str.find(pattern, len_pattern + index)\n        if index == -1:\n            return [-1, -1]\n        i = length - index - 1\n\n        return [i, j]\n```
['Python', 'Python3']