Determine whether an array can be split into pairs so that every element appears in exactly one pair of equal values.
Given an integer array nums, decide whether it is possible to partition the array into disjoint pairs such that both numbers in every pair are equal.
In other words, every element must be matched with exactly one other occurrence of the same value, and no element can be left unpaired.
Return true if such a partition exists, otherwise return false.
nums.true if the array can be divided into equal-value pairs, otherwise false.1 <= nums.lengthnums.length is evenExample 1
Input
nums = [3,2,3,2,2,2]
Output
true
Explanation
The array can be partitioned into pairs like (3,3), (2,2), and (2,2).
Example 2
Input
nums = [1,2,3,4]
Output
false
Explanation
Each value appears only once, so no equal pair can be formed.
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.