Python Solution

  • 0
    class Solution(object):
        def leastBricks(self, wall):
            :type wall: List[List[int]]
            :rtype: int
            map = {}
            for i in range(len(wall)):
                sum = 0
                for j in range(0, len(wall[i])-1):
                    sum += wall[i][j]
                    if map.get(sum) is not None:
                        map[sum] += 1
                        map[sum] = 1
            return len(wall) - max(map.values()) if map.values() else len(wall)

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.