Skip to content

Commit

Permalink
Q1877 added.
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Mar 3, 2023
1 parent 5c793ca commit eb38d90
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions M_1877_MinimizeMaximumPairSuminArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution {
public int minPairSum(int[] nums) {
Arrays.sort(nums);
int left=0;
int right=nums.length-1;
int ret=0;
while (left<right){
if(ret<nums[left]+ nums[right])
ret=nums[left]+ nums[right];
left++;
right--;
}
return ret;
}
}

0 comments on commit eb38d90

Please sign in to comment.