Python 3 Solution Explained
\nclass Solution:\n    def threeEqualParts(self, A):\n        """\n        Given an array of ones and zeros, this program determines whether\n        the array 
```\nclass Solution:\n    def threeEqualParts(self, A):\n        """\n        Given an array of ones and zeros, this program determines whether\n        the array can be partitioned three ways where each partition contains\n        the same pattern of ones and zeros beginning with a one.  If there\n        are no ones, the presence of at least three zeros makes a partition\n        possible.\n\n        :param A: array of 1\'s and 0\'s\n        :type A: list[int]\n        :return: pair of integers\n                 [last location partion 1, first location after partition 2]\n                 or [-1, -1] if partition is not possible\n        :rtype: list[int]\n        """\n        """\n        Initialize:\n        - length of A\n        - get number of ones in A\n        """\n        len_A = len(A)\n        ones = A.count(1)\n\n        """\n        If A is all zeros, a valid partition is possible if the length\n        of A is 3 or greater.\n        """\n        if ones == 0:\n            if len_A >= 3:\n                return [0, len_A - 1]\n            else:\n                return[-1, -1]\n\n        """\n        The number of ones must be divisible by 3 in order for it to be\n        possible to partition A.\n        """\n        if ones % 3:\n            return [-1, -1]\n\n        """\n        If we have gotton this far, the number of ones in A is divisible\n        by 3. It is now possible to scan A to find the start of each pattern.\n        It is also possible to determine the length of the pattern from the\n        third pattern.\n        """\n        ones_in_pattern = ones // 3\n        pattern_starts = []\n        ones_count = 0\n        for k, a in enumerate(A):\n            if a:\n                ones_count += 1\n                if ones_in_pattern == 1 \\\n                    or ones_count % ones_in_pattern == 1:\n                    pattern_starts.append(k)\n        s1, s2, s3 = pattern_starts\n        len_pattern = len(A[s3:])\n\n        """\n        Compare the patterns and return the result.\n        """\n        if A[s1:s1 + len_pattern] == A[s2:s2 + len_pattern] == A[s3:]:\n            return [s1 + len_pattern - 1, s2 + len_pattern]\n        return [-1, -1]\n\n```
['Python3']