Originally Posted by

**narjunkumar** Let me give you an example with N=4, and M=2. Now, you can think of any number from 1 to 4. I am going to show you cards, with each card having 2 numbers in it, where each number is between 1 to 4. (Since M=2). For this problem, I know that 2 cards would be enough.

I show you Card1(1,2) and Card2(2,3).. and ask you whether the number you thought of is there or not. And based on your answer I can ascertain what number you thought of. (00 - 4; 01 = 3; 10 - 1; 11 - 2).

For a case, where N=3, and M=1.. the answer is that I would have to show you two cards at least.. each card having 1 number written in it.. to make the guess.

So for any N and M.. my idea was that.. assume you need minimum K cards.. so I would get a boolean number as answer. Every answer, I map to a particular number in N.. (lets say... 000111.. (length K) is mapped to 1). Thus you would have N possible answers, which means the boolean matrix will have N rows.. and it will have K columns.. with each column having exactly M 1's. (since every card has M numbers in it).