2125. Number of Laser Beams in a Bank
Содержание
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