Java Solution || 96.9% faster
\n\n# Code\n\nclass Solution {\n    public int numberOfBeams(String[] bank) {\n      int ones=0;\n      int sum=0;\n      for(String stu:bank){\n          int c
\n\n# Code\n```\nclass Solution {\n    public int numberOfBeams(String[] bank) {\n      int ones=0;\n      int sum=0;\n      for(String stu:bank){\n          int counter=0;\n          for(char ch:stu.toCharArray()){\n              if(ch==\'1\'){\n                  counter++;\n              }\n          }\n\n          if(counter>0){\n              sum+=counter*ones;\n              ones=counter;\n\n          }\n      }\n      return sum;\n    }\n}\n```
['Java']