Simplest JAVA Solution
\nclass Solution {\n    public int numberOfBeams(String[] bank) {\n        int prevRowGuns = 0;\n        int ans = 0;\n        for(String b : bank){\n          
```\nclass Solution {\n    public int numberOfBeams(String[] bank) {\n        int prevRowGuns = 0;\n        int ans = 0;\n        for(String b : bank){\n            int curRowGuns = 0;\n            for(int i=0;i<b.length();i++){\n                if(b.charAt(i)==\'1\'){\n                    curRowGuns++;\n                }\n            }\n            if(curRowGuns!=0){\n                ans +=prevRowGuns*curRowGuns;\n                prevRowGuns=curRowGuns;\n            }\n        }\n        return ans;\n    }\n}\n```
['Java']