**Solution with discussion**https://leetcode.com/problems/contiguous-array/?tab=Description

**Contiguous Array** https://leetcode.com/problems/contiguous-array/?tab=Description

- Replace 0 by -1 and compute the cumulative sum.
- Equal number of 0 and 1 will be subarray with sum equal to 0.
- Initialize cumulative sum 0 at index -1. Run over example [0,1].
- https://discuss.leetcode.com/topic/80056/python-o-n-solution-with-visual-explanation

```
class Solution(object):
def findMaxLength(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
cache, cums, max_so_far = {0:-1}, 0, 0
for idx,x in enumerate(nums):
cums = cums - 1 if x == 0 else cums + 1
if cums in cache:
max_so_far = max(max_so_far, idx-cache[cums])
else:
cache[cums] = idx
return max_so_far
```