Easy approach using Prefix Sum + 2 Sum [no one is talking about this]
Prefix Sum\nNo post is talking about this apporach, and I came up with this when sleeping.\nTypically, sum of subarray problem can be resovled using prefix sum 
### Prefix Sum\nNo post is talking about this apporach, and I came up with this when sleeping.\nTypically, sum of subarray problem can be resovled using prefix sum array. So is this. Similarly, the `prefix[i]` represents the integer with the binary representation of `nums[:i]`, then `prefix[j] - prefix[i]` is the integer represented by `nums[i:j]`. \n\n```\nprefix[i + 1] = prefix[i] << 1 + num[i]\nprefix[j + 1] - prefix[i + 1] = prefix[j + 1] - (prefix[i] << j - i)\n```\n\nIn order to find out 3 subarrays with the same integer, we just need find out `[i, j]` such that \n\n```prefix[i - 1] == prefix[j] - prefix[i] == prefix[-1] - prefix[j]```\n\nThe naive solution is to iterate each possible pair of `(i, j)`, but we can reduce it to linear using hashmap/dictionary. Recall the 2 sum problem!\nWe iterate each *j* and store the index *i* of `prefix[i]` seen up to *j*, then if `prefix[-1] - prefix[j]` is in the hashmap, then return the pair. Finally, reutrn `[-1, -1]` otherwise.\n\n```python\ndef threeEqualParts(self, arr: List[int]) -> List[int]:\n\tprefix = [0]\n    for num in arr:\n\t\tprefix.append((prefix[-1] << 1) + num)\n        \n\tseen = {}\n    n = len(arr)\n    for j in range(n): \n\t\tx = prefix[-1] - (prefix[j + 1] << n - 1 - j)\n        if x in seen and prefix[j + 1] == (x << j + 1 - seen[x]) + x:\n\t\t\treturn [seen[x] - 1, j + 1]\n        seen[prefix[j + 1]] = j + 1\n\treturn [-1, -1]     \n        \n```\n*Time Complexity* = **O(N)**\n*Space Complexity* = **O(N)**
[]