public class Solution {
public int NumberOfBeams(string[] bank) {
int pre_lesers = 0;
int beams = 0;
foreach (string floor in bank){
int current_lesers = 0;
foreach (char c in floor){
if (c == '1')
current_lesers += 1;
}
if (current_lesers==0)
continue;
beams += pre_lesers * current_lesers;
pre_lesers = current_lesers;
}
return beams;
}
}