Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Simply simulate the algorithm.
Note that the size of the array decreases exponentially, so the process will terminate after just O(log n) steps.
Solve with full IDE support and test cases