nums
in ascending order.maxSum
to 0
to keep track of the maximum pair sum.0
to nums.length / 2 - 1
.i
, calculate the pair sum of nums[i]
and nums[nums.length - 1 - i]
.maxSum
with the maximum of the current maxSum
and the calculated pair sum.maxSum
as the minimized maximum pair sum.