C++ Solution
Intuition\n\n\n# Approach\n- Initialize res=0 & remianing=0\n- Count the number of 1s in each string\n- If count of 1s in a string is more than zero then \n    
# Intuition\n\n\n# Approach\n- Initialize res=0 & remianing=0\n- Count the number of 1s in each string\n- If count of 1s in a string is more than zero then \n    res += count * remaining;\n    remaining = count;\n\n# Complexity\n- Time complexity: O (N * sizeof(back[i]));\n\n- Space complexity: O (1)\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfBeams(vector<string>& bank) {\n        int res = 0;\n        int remaining = 0;\n        for (int i=0; i<bank.size(); i++)\n        {\n            string temp = bank[i];\n            int count = 0;\n            for (int i=0; i<temp.size(); i++)\n            {\n                if (temp[i]==\'1\')\n                    count++;\n            }\n            if (count)\n            {\n                res += count*remaining;\n                remaining = count;\n            }\n            \n        }\n        return res;\n    }\n};\n```
['C++']