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.
- Prepare
- Algorithms
- Game Theory
- Misère Nim
- Discussions
Misère Nim
Misère Nim
Sort by
recency
|
34 Discussions
|
Please Login in order to post a comment
How did you know that an XOR operation solved the problem? What is the relationship?
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star :) )
here it is my python code : from functools import reduce def misereNim(s): if (set(s)=={1}) and n%2==1: return 'Second' elif (set(s)=={1}) and n%2==0: return 'First' elif reduce((lambda x,y:x^y),s): return 'First' else: return 'Second'
Here is Misere Nim problem solution in Python Java C++ and c programming - https://programs.programmingoneonone.com/2021/07/hackerrank-misere-nim-problem-solution.html