[C++] A very simple approach to this problem, beats 89%
Approach\n Describe your approach to solving the problem. \nWe simply traverse over all the rows (floors), while keeping a count of the number of cameras seen o
# Approach\n<!-- Describe your approach to solving the problem. -->\nWe simply traverse over all the rows (floors), while keeping a count of the number of cameras seen on the previous floor having cameras. Then we simply apply the multiplicative rule of PnC to get the required combinations sum.\n\n# Complexity\n- Time complexity: $$O(m*n)$$ for traversing the prison matrix, where m is the number of floors and n is the number of cells on each floor.\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfBeams(vector<string>& bank) {\n        int ans = 0, curr = 0;\n        for (string s: bank) {\n            int devices = 0;\n            for (char ch: s) {\n                if (ch == \'1\') devices++;\n            }\n            if (devices) {\n                ans += (devices * curr);\n                curr = devices;\n            }\n        }\n        return ans;\n    }\n};\n```
['Array', 'Math', 'String', 'Matrix', 'C++']