Sponsored
Use these hints if you're stuck. Try solving on your own first.
Simulate the process while keeping track of visited points.
Use a set to store previously visited points.
Solve with full IDE support and test cases