[PYTHON 3] 99.13% LESS MEMORY | 94.93% FASTER | EXPLANATION
Runtime: 87 ms, faster than 94.93% of Python3 online submissions for Number of Laser Beams in a Bank.\nMemory Usage: 15.9 MB, less than 99.13% of Python3 online
Runtime: **87 ms, faster than 94.93%** of Python3 online submissions for Number of Laser Beams in a Bank.\nMemory Usage: **15.9 MB, less than 99.13%** of Python3 online submissions for Number of Laser Beams in a Bank.\n\n```\nclass Solution:\n    def numberOfBeams(self, bank: List[str]) -> int:\n        a, s = [x.count("1") for x in bank if x.count("1")], 0\n\n\t\t# ex: bank is [[00101], [01001], [00000], [11011]]\n\t\t# a would return [2, 2, 4]\n\n        for c in range(len(a)-1):\n            s += (a[c]*a[c+1])\n\n\t\t\t# basic math to find the total amount of lasers\n\t\t\t# for the first iteration: s += 2*2\n\t\t\t# for the second iteration: s += 2*4\n\t\t\t# returns s = 12\n\n        return s\n                            \n
['Python', 'Python3']