Sponsored
Use these hints if you're stuck. Try solving on your own first.
For each index i, how can we check if nums[i] can be present at the top of the pile or not after k moves?
For which conditions will we end up with an empty pile?
Solve with full IDE support and test cases