Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Do each case (even indexed is greater, odd indexed is greater) separately. In say the even case, you should decrease each even-indexed element until it is lower than its immediate neighbors.