Practice Array Partition
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized sum.
Source: Array Partition on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [1,4,3,2]
Output
4
# Example 2
Input
nums = [6,2,6,5,1,2]
Output
9
Constraints
1 <= n <= 10^4
nums.length == 2 * n
-10^4 <= nums[i] <= 10^4
Related LeetCode Problems
Practice more problems similar to Array Partition.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.