stones stones on the table. You and an opponent take turns, and you go first. On each turn a player must take 1, 2 or 3 stones from the pile. Whoever takes the last stone wins.
Both players play perfectly. Return True if you can force a win, and False otherwise.stones=4 → False
Whether you take 1, 2 or 3 stones, your opponent takes the rest and wins.
stones=7 → True
Take 3 stones: 4 are left, and now your opponent is the one in a losing spot.
stones=2 → True
You take both stones at once.
stones=4
False
Run checks the first 3 tests in your browser. Submit checks all 117 tests on the server, hidden ones included.