HTMLify
LeetCode - Number of Laser Beams in a Bank - Python
Views: 449 | Author: abh
1 2 3 4 5 6 7 8 9 10 | class Solution: def numberOfBeams(self, bank: List[str]) -> int: beams = 0 pre_lesers = 0 for floor in bank: if floor.count("1") == 0: continue beams += pre_lesers * floor.count("1") pre_lesers = floor.count("1") return beams |