Given a vector of binary strings of size n. Tell the minimum operations you should perform so that a column has only 1s in it.
In one operation you can either shift the string to right or to left by 1 position.
Testcase -
vector <string> bs = ["0101" , "1010" , "0100" , "0001"]assume bs.size() as rows and bs[0].size() as columns.
Output - 3
Explanation-
0101 -> 1010 (shifted string 1 place clockwise)
1010 -> 1010(no need to shift)
0100 -> 0010(1 shift clockwise)
0001 -> 0010 (1 shift anticlockwise)
I couldn't solve it in the OA. Any help would be appreciated.