This problem has confused me for a while.

  • 0
    Just hope this would do some help for those who get confused like me.    
    The result of system  of input "8" is false, however, i got true.
    I thought they move 3 each time, and the last stone is moved by the first person,so he can win.
    In fact, the problem contains a restriction that it does not say clearly, which is if 3 each time, the person should will always move 3 until the last time, not 1 or 2. In my case, the last time, the person removed 2.

  • 0

    @van.zengfu The question really means that? I think in this problem, every one can remove 1 or 2 or 3 stones each time. In the case of 8 stones, whatever case your friend will win, since your friend is clever enough to choose the right strategy every time. For example if there are 8 stones, if you remove 1 first, your friend will remove 3, than there are 4 remain, you lose. If you remove 2 first, your friend will remove 2, than 4 remain again, you lose. If you remove 3 first, your friend will remove 1, 4 remain, you lose. Is that make sense?

  • 0

    I may fell in some trap. Here is my thought.

    Given 8, I remove 3 first, and he removes 3, then there are 2 left. If i remove 2, i win.

    The problem is 'whether you can win the game given the number of stones in the heap', So My solution tells that i can win with the way above, am i?

    I find a way to remove the last one, only the last time i remove 2, not 3.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.