Skip to content

Commit 4483a38

Browse files
committed
Time: 587 ms (92.86%), Space: 56.5 MB (71.43%) - LeetHub
1 parent 50ef8d2 commit 4483a38

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
fun minPairSum(nums: IntArray): Int {
3+
nums.sort()
4+
5+
val last = nums.size - 1
6+
var max = 0
7+
for (i in 0 until nums.size / 2) {
8+
max = maxOf(max, nums[i] + nums[last - i])
9+
}
10+
11+
return max
12+
}
13+
}

0 commit comments

Comments
 (0)