You are viewing a single comment's thread. Return to all comments →
C# O(1) one-liner:
public static string counterGame(long n) { return (long.PopCount(n) + long.TrailingZeroCount(n)) % 2 == 0 ? "Louise" : "Richard"; }
Makes use of POPCNT and TZCNT instructions, both O(1) on x86.
POPCNT
TZCNT
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 →
C# O(1) one-liner:
Makes use of
POPCNT
andTZCNT
instructions, both O(1) on x86.