
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Given a target sum x, each pair of nums[i] and nums[n-1-i] would either need 0, 1, or 2 modifications.
Can you find the optimal target sum x value such that the sum of modifications is minimized?
Create a difference array to efficiently sum all the modifications.