Tap here to switch tabs
Problem
Submissions

Problem: Find the Value of the Partition

med
30 min
Try to solve the Find the Value of the Partition problem.

Statement

You are given an integer array nums.

You must partition nums into two arrays, nums1 and nums2, such that:

  • Each element of nums belongs to either nums1 or nums2.

  • Both nums1 and nums2 are not empty.

  • The value of the partition is defined as ∣max⁡(| \max(nums1)−min⁡() - \min(nums2)∣) |.

Return the minimum possible value of the partition among all possible configurations.

Constraints:

  • 2≤2 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Value of the Partition

med
30 min
Try to solve the Find the Value of the Partition problem.

Statement

You are given an integer array nums.

You must partition nums into two arrays, nums1 and nums2, such that:

  • Each element of nums belongs to either nums1 or nums2.

  • Both nums1 and nums2 are not empty.

  • The value of the partition is defined as ∣max⁡(| \max(nums1)−min⁡() - \min(nums2)∣) |.

Return the minimum possible value of the partition among all possible configurations.

Constraints:

  • 2≤2 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9