You are playing the following Nim Game with your friend: there is a heap of stones on the table, and each turn one of you removes 1 to 3 stones. The player who removes the last stone wins. You go first.

Both players are perfectly rational and always play optimally. Write a function to determine whether you can win the game given the number of stones in the heap.

For example, if there are 4 stones in the heap, you will never win: no matter whether you remove 1, 2, or 3 stones, your friend will always be the one to take the last stone.

Hint:

  1. If there are 5 stones in the heap, can you figure out a strategy that guarantees you always win?
  bool canWinNim(int n) {
        return n%4 != 0;
    }