# Count gaps
class Solution:
    def leastBricks(self, wall: List[List[int]]) -> int:
        cnt = Counter()
        for w in wall:
            r = 0
            for c in w[:-1]:
                r += c
                cnt[r] += 1
        if cnt: return len(wall)-cnt.most_common(1)[0][1]
        else: return len(wall)
e9f0d1b0302b6fc27bed0e35a697eae0c5c7a72e
<mask token>

class Solution:
    <mask token>

class Solution:

    def leastBricks(self, wall: List[List[int]]) ->int:
        cnt = Counter()
        for w in wall:
            r = 0
            for c in w[:-1]:
                r += c
                cnt[r] += 1
        if cnt:
            return len(wall) - cnt.most_common(1)[0][1]
        else:
            return len(wall)

# Count gaps
class Solution:
    def leastBricks(self, wall: List[List[int]]) -> int:
        cnt = Counter()
        for w in wall:
            r = 0
            for c in w[:-1]:
                r += c
                cnt[r] += 1
        if cnt: return len(wall)-cnt.most_common(1)[0][1]
        else: return len(wall)