Skip to content

Commit bf8af41

Browse files
committed
Runtime: 89 ms (Top 12.88%) | Memory: 106.2 MB (Top 42.39%)
1 parent 455829a commit bf8af41

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
// Runtime: 89 ms (Top 12.88%) | Memory: 106.2 MB (Top 42.39%)
12
class Solution {
23
public int minPairSum(int[] nums) {
34
Arrays.sort(nums);
4-
5+
56
int output = Integer.MIN_VALUE;
6-
7-
//This is greedy, so n/2 pairs must be from start and end and move inwards
7+
8+
//This is greedy, so n/2 pairs must be from start and end and move inwards
89
for(int i=0, j=nums.length - 1; i<nums.length/2; i++, j--)
910
{
1011
output = Math.max(output, nums[i] + nums[j]);
1112
}
12-
13+
1314
return output;
1415
}
1516
}
16-

0 commit comments

Comments
 (0)