Determine whether an array can be split into two non-empty subsets whose element products are equal.
Given an array of integers, decide whether it is possible to split the elements into two non-empty groups such that the product of all numbers in the first group is exactly the same as the product of all numbers in the second group.
Every element must belong to exactly one of the two groups.
Return true if such a split exists, otherwise return false.
nums.Example 1
Input
nums = [2, 3, 6]
Output
true
Explanation
One valid split is [2, 3] and [6]. Both subsets have product 6.
Example 2
Input
nums = [1, 2, 4]
Output
false
Explanation
The possible non-empty splits are [1] and [2, 4], [2] and [1, 4], or [4] and [1, 2]. Their products are 1 vs 8, 2 vs 4, and 4 vs 2, so no split has equal products.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.