shlogg · Early preview
Md Ariful Haque @mah-shamim

Divide Array Into Equal Pairs: Check Even Counts

Can an array be divided into pairs where each pair has equal elements? Count frequencies, check if all are even. If yes, return true; otherwise, false.

2206. Divide Array Into Equal Pairs
Difficulty: Easy
Topics: Array, Hash Table, Bit Manipulation, Counting
You are given an integer array nums consisting of 2 * n integers.
You need to divide nums into n pairs such that:

Each element belongs to exactly one pair.
The elements present in a pair are equal.

Return true if nums can be divided into n pairs, otherwise return false.
Example 1:

Input: nums = [3,2,3,2,2,2]
Output: true
Explanation:

There are 6 elements in nums, so they should be divided into 6 / 2 = 3 pairs.
If nums is divided into the pairs (2, 2), (3, 3), and (2, 2), it will satis...