Java Easy Consise Easiest O(mn)
\nclass Solution {\n    public int numberOfBeams(String[] bank) {\n        int res = 0, prev = 0;\n        for(String str:bank){\n            int cur = 0;\n    
```\nclass Solution {\n    public int numberOfBeams(String[] bank) {\n        int res = 0, prev = 0;\n        for(String str:bank){\n            int cur = 0;\n            for(char ch:str.toCharArray()) if(ch == \'1\') cur++;\n            if(prev != 0) res += cur * prev;\n            if(cur != 0) prev = cur;\n        }\n        return res;\n    }\n}\n```
['Java']