Set Split
Given a list of positive integers nums, return whether you can divide the list into two groups a and b such that:
- The sum of
aand the sum ofbare equal. - Every number in
ais strictly less than every number inb.
Constraints
1 ≤ n ≤ 100,000wherenis the length ofnums.
https://binarysearch.com/problems/Set-Split
Examples
Example 1
Input
- nums =
[9, 9]
Output
- answer =
False
Explanation
We can have a = [9] and b = [9] but it doesn’t meet this criteria: “Every number in a is strictly less than every number in b.”
Example 2
Input
- nums =
[4, 9, 5]
Output
- answer =
True
Explanation
We can have a = [4, 5] and b = [9] and both of their sums are 9.
Leave a comment