You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star :) )
std::string misereNim(std::vector<int> const & _piles){ int binSum = 0; int sum = 0; for(auto const & stones : _piles){ binSum ^= stones; sum += stones; } if(_piles.size() == sum){ return _piles.size() % 2 == 0 ? "First" : "Second"; } return binSum ? "First" : "Second"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Misère Nim
You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star :) )