Sort 38 Discussions, By:
Please Login in order to post a comment
Same as regular game of Nim!
Some insight: being able to add to the pile makes no difference to a regular game of nim. If Player A has a winning position in the game of nim, Player A may keep playing optimally as they would play a regular nim game. If, however, Player B decides to add k items to a pile, putting Player A in a losing position, Player A may add the same number, k, items to the same pile, reclaiming thier winning position. Or, even better, Player A may simply remove the items added by Player B.
def pokerNim(k, c):
for i in c:
Given the list of Nim heaps, will player 1 or player 2 win?
I hope that helps!
The task contains errors: both, the test case 2 and test case 3 contain subtests where k = 0. Accoeding to the conditions such cases must be excluded (1 <= n,k <= 100). I see again and again errors in provided test cases, hackerrank does not do proper check of tasks and tests,