class Solution(object):
def leastBricks(self, wall):
"""
:type wall: List[List[int]]
:rtype: int
"""
ht = len(wall)
wt = sum(wall[0])
d = {}
for row in wall:
tot = 0
for brick in row:
tot += brick
if tot < wt:
if tot in d:
d[tot] -= 1
else:
d[tot] = ht - 1
l = list(d.values())
l.append(ht)
return min(l)