The idea is to compute the cumulative sum of each row and find which cumsum appears most of the time

```
class Solution(object):
def leastBricks(self, wall):
"""
:type wall: List[List[int]]
:rtype: int
"""
counter = collections.Counter()
for bricks in wall:
cumsum = 0
for i in xrange(len(bricks)-1):
cumsum += bricks[i]
counter[cumsum] += 1
return len(wall) if not counter.values() else len(wall) - max(counter.values())
```