Sponsored
Use these hints if you're stuck. Try solving on your own first.
Just apply what's said in the statement.
Notice that you can't apply it on the same array directly since some elements will change after application
Solve with full IDE support and test cases