Easy to Understand Java n Python Solution
PYTHON\n\nclass Solution:\n    def numberOfBeams(self, bank: List[str]) -> int:\n        y=[]\n        for x in bank:\n            if x.count(\'1\') == 0:\n    
**PYTHON**\n```\nclass Solution:\n    def numberOfBeams(self, bank: List[str]) -> int:\n        y=[]\n        for x in bank:\n            if x.count(\'1\') == 0:\n                continue\n            else:\n                y.append(x.count(\'1\'))\n        hasil=0\n        if len(y)==0:\n            return 0\n        else:\n            for i in range(len(y) - 1):\n                hasil+=y[i]*y[i+1]\n            return hasil\n```\n**JAVA**\n```\nclass Solution {\n    public int numberOfBeams(String[] bank) {\n        int prev=0; int res=0;\n        for(String s: bank){\n            int count=0;\n            for(char ch: s.toCharArray()){\n                if(ch==\'1\'){\n                    count++;\n                }\n            }\n            if(count>0 && prev==0){\n                prev=count;\n            }else if(count>0){\n                res+=(count*prev);\n                prev=count;\n            }\n        }\n        return res;\n    }\n}\n```\n* **Time Complexity** :- BigO(N) where N is total characters in bank\n\n* **Space Complexity** :- BigO(1)
['Python', 'Java']