You are given an integer n representing the number of stones in a pile.
Your task is to determine if you can win a Nim game against a friend, assuming you are the first player.
Note that:
Return true if you can win the game, and false otherwise.
4
False
If there are 4 stones, no matter how many stones you remove (1, 2, or 3), your friend can always remove the remaining stones to win. For example, if you remove 1, 3 stones remain, friend removes 3. If you remove 2, 2 stones remain, friend removes 2. If you remove 3, 1 stone remains, friend removes 1. In all scenarios, the first player (you) loses.
1
True
You can remove 1 stone and win immediately.
5
True
You can remove 1 stone, leaving 4 stones. Now, it's your friend's turn with 4 stones. As shown in the previous example, if your friend starts with 4 stones, they will lose. Thus, you win.
4
False