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.
c++ solution
i prepare an array that stores consecutive values of power of 2.
then i do simulation of the game and checking if the current 'n' is power of 2 which in binary has only 1 bit set, hence i use built-in function to count bits that are 1 in a number. I also keep track of who would win at the moment in 'louise' variable
Counter game
You are viewing a single comment's thread. Return to all comments →
c++ solution i prepare an array that stores consecutive values of power of 2. then i do simulation of the game and checking if the current 'n' is power of 2 which in binary has only 1 bit set, hence i use built-in function to count bits that are 1 in a number. I also keep track of who would win at the moment in 'louise' variable