Practice Partition Array Into Two Arrays to Minimize Sum Difference
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Partition Array Into Two Arrays to Minimize Sum Difference
Problem Statement
You are given an integer array nums of 2 * n integers. You need to partition nums into two arrays of length n to minimize the absolute difference of the sums of the arrays. To partition nums, put each element of nums into one of the two arrays. Return the minimum possible absolute difference.
Source: Partition Array Into Two Arrays to Minimize Sum Difference on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [3,9,7,3]
2
# Example 2
nums = [-36,36]
72
# Example 3
nums = [2,-1,0,4,-2,-9]
0
Constraints
Related LeetCode Problems
Practice more problems similar to Partition Array Into Two Arrays to Minimize Sum Difference.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.