I have a large set (100 000) of binary strings (fixed length k) like this: "011100001111000010", "111011011110000100" etc. Some binary strings include leading zeros. I'd like to obtain a list L of length k such that a[i] = the number of binary strings having 1 on ith place. For example:
Input:
"1011"
"0111"
"0111"
Output:
[1,2,3,3]
Since the number of binary strings is very big (100000+) and k is around 100 using nested for loops seems to be very inefficient. What would be the most efficient (or at least more efficient) way to tackle this?