2740. Find the Value of the Partition
You are given a positive integer array nums. Partition nums into two arrays, nums1 and nums2, such that: - Each element of the array nums belongs to either the array nums1 or the array nums2. - Both arrays are non-empty. - The value of the partition is minimized. The value of the partition is |max(nums1) - min(nums2)|. Here, max(nums1) denotes the maximum element of the array nums1, and min(
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start