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.
- Counter game
- Discussions
Counter game
Counter game
Sort by
recency
|
199 Discussions
|
Please Login in order to post a comment
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
Javascript (ugly, non-math-based version)
C# O(1) one-liner:
Makes use of
POPCNT
andTZCNT
instructions, both O(1) on x86.