- Problem
554. Brick Wall
- 내 풀이
class Solution:
def leastBricks(self, wall: List[List[int]]) -> int:
bricks = collections.defaultdict(int)
bricks[0] = 0
for brick in wall:
for i in list(accumulate(brick))[:-1]:
bricks[i] += 1
return len(wall) - max(bricks.values())
- 결과