# 17.11.2023 [1877. Minimize Maximum Pair Sum in Array]
Minimum possible max of array pairs sums
17.11.2023
1877. Minimize Maximum Pair Sum in Array medium
blog post
Join me on Telegram
https://t.me/leetcode_daily_unstoppable/407
Problem TLDR
Minimum possible max of array pairs sums
Intuition
The optimal construction way is to pair smallest to largest.
Approach
We can use two pointers and iteration, let’s write non-optimal one-liner however
Complexity
Time complexity:
O(nlog(n))Space complexity:
O(1), this solution takes O(n), but can be rewritten
Code
fun minPairSum(nums: IntArray): Int =
nums.sorted().run {
zip(asReversed()).maxOf { it.first + it.second }
}