You are viewing a single comment's thread. Return to all comments →
For those, who might wonder, here's java solution.
static String counterGame(long n) { return (Long.bitCount(n - 1) - 1 & 1) == 0 ? "Louise" : "Richard"; }
I did it almost independently, and the key, as probably was noticed, to look into equivalence of cases n and n - 1.
n
n - 1
Seems like cookies are disabled on this browser, please enable them to open this website
Counter game
You are viewing a single comment's thread. Return to all comments →
For those, who might wonder, here's java solution.
I did it almost independently, and the key, as probably was noticed, to look into equivalence of cases
n
andn - 1
.