We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here's my math behind the problem. I am not able to understand why is it wrong.
A is first. B is second.
Initially let say the total no. of chips to be T. If T is even After a full move(i.e. A and B both move provided game has not ended) the total no. of chips would still remain even. And same reasoning goes for the odd case.
Now if addition was not allowed T would have determined who is winner. If T were odd A would else B would.
Now even though addition is allowed but after a move the total no. of elements stay in same state. i.e. if T = even, then after each move the total chips would still be even. and vice versa. Hence win is also decided by the same as above. So even though addition is allowed still the factor of 'k'(the total no. of addition available for each pile) is not doing anything to the problem.
So where is the factor k playing role here ? what was the need of i piles when all of this is can be done using single pile ? And where is my math going wrong ??? Have I not understood the Q correctly ?
Heres how I understood the Q.-
There are 2 players A and B. There are i piles. In each pile eachof the players can add maximum of k tokens. They can add even though the ith pile is finished. Now both are playing selfishly. Who will win if A starts
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Poker Nim
You are viewing a single comment's thread. Return to all comments →
Hi,
Here's my math behind the problem. I am not able to understand why is it wrong.
A is first. B is second. Initially let say the total no. of chips to be T. If T is even After a full move(i.e. A and B both move provided game has not ended) the total no. of chips would still remain even. And same reasoning goes for the odd case.
Now if addition was not allowed T would have determined who is winner. If T were odd A would else B would.
Now even though addition is allowed but after a move the total no. of elements stay in same state. i.e. if T = even, then after each move the total chips would still be even. and vice versa. Hence win is also decided by the same as above. So even though addition is allowed still the factor of 'k'(the total no. of addition available for each pile) is not doing anything to the problem.
So where is the factor k playing role here ? what was the need of i piles when all of this is can be done using single pile ? And where is my math going wrong ??? Have I not understood the Q correctly ?
Heres how I understood the Q.- There are 2 players A and B. There are i piles. In each pile eachof the players can add maximum of k tokens. They can add even though the ith pile is finished. Now both are playing selfishly. Who will win if A starts