Boolean Matrix : Minimum number of columns
I was trying to solve a programming problem.. and it narrowed down to this question.
I am given N and M (both non-zero integers and M<N).. I need to construct a boolean matrix such that
1. Number of rows have to be equal to N
2. Every column must have M 1's exactly(rest 0)
3. No two rows should be the same.
I need to get the minimum number of columns for it, given N and M.
For eg: Assume, I am given (4,2)..
I can have a matrix like,
satisfying all the above conditions. So the answer here would be 2 columns.