Sponsored
Use these hints if you're stuck. Try solving on your own first.
N is small, we can generate all possible move combinations.
For each possible move combination, determine which ones are valid.
Solve with full IDE support and test cases