100% TC easy python solution
Hint\nCount the num of ones, and think how they will be split between the 3 segments :)\n\ndef threeEqualParts(self, arr: List[int]) -> List[int]:\n\tn = len(ar
Hint\nCount the num of ones, and think how they will be split between the 3 segments :)\n```\ndef threeEqualParts(self, arr: List[int]) -> List[int]:\n\tn = len(arr)\n\tpos = [i for i in range(n) if(arr[i])]\n\tl = len(pos)\n\tif(l == 0):\n\t\treturn [0, 2]\n\tif(l % 3):\n\t\treturn [-1, -1]\n\tones = l//3\n\tc = 0\n\tfor i in arr[::-1]:\n\t\tif(i == 1):\n\t\t\tbreak\n\t\tc += 1\n\tans = [-1, -1]\n\t# one hoga pos[ones-1] tak\n\t# uske bad chaiye meko c zeros\n\t# toh index pos[ones-1] + c tak first segment ho jayega\n\tans[0] = pos[ones-1] + c\n\tans[1] = pos[2*ones-1] + c + 1\n\tseg1, seg2, seg3 = arr[pos[0]:ans[0]+1], arr[pos[ones]:ans[1]], arr[pos[2*ones]:]\n\t# without leading zeros\n\tif(seg1 != seg2 or seg1 != seg3):\n\t\treturn [-1, -1]\n\treturn ans\n```
['Python', 'Python3']