Description
Given an integer array nums, return true if nums can be split into two non-empty subsets with equal average value.
Examples
Input:
nums = [1,2,3,4,5,6,7,8]Output:
trueExplanation:
[1,4],[2,3,5,6,7,8].
Input:
nums = [3,1]Output:
falseExplanation:
The only possible split is [3] and [1], which have averages 3 and 1 respectively. There is no way to split the array into two non-empty parts with equal averages.
Input:
nums = [2,4,6,8]Output:
trueExplanation:
Splitting into [2,6] and [4,8] gives both groups the same average of 4.
Constraints
- •
1 ≤ nums.length ≤ 30