Sponsored
Use these hints if you're stuck. Try solving on your own first.
Simulate the process. We can do it with a heap, or by sorting some list of stones every time we take a turn.
Solve with full IDE support and test cases