HTMLify

LeetCode - Number of Laser Beams in a Bank - Python
Views: 113 | Author: abh
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

Comments