class Solution(object):
def leastBricks(self, wall):
"""
:type wall: List[List[int]]
:rtype: int
"""
max_length = max([sum(wal) for wal in wall])
route_dict = {}
height = 0
max_dict = 0
for wal in wall:
height += 1
temp = 0
for i in wal:
temp += i
if temp != max_length:
if route_dict.has_key(temp):
route_dict[temp] += 1
else:
route_dict[temp] = 1
if route_dict[temp] > max_dict:
max_dict = route_dict[temp]
return height - max_dict
经验: 水题,但是如果数据规模比较大的话不知道该怎么处理,算法部分没想到更好的方法