2125. Number of Laser Beams in a Bank

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2125

class Solution:
    def numberOfBeams(self, bank: List[str]) -> int:
        last = res = 0
        for b in bank:
            if (t := b.count('1')) > 0:
                res += last * t
                last = t
        return res