You are given an array nums containing 2 * n integers. Your goal is to split the array into n pairs where:
Each number appears in exactly one pair.
Both values in every pair must be identical.
Return true if such a pairing is possible. Otherwise, return false.
Input: nums = [5,5,7,7,7,7]
Output: true
Explanation:
We have 6 elements → need 3 pairs. Possible pairs: (5,5), (7,7), (7,7) Each pair contains equal values, so pairing is valid.
Input: nums = [4,1,4,2]
Output: false
Explanation:
We need two pairs, but there is only one '1' and one '2', so they cannot form pairs of equal values.
Accepted:
Submission: