less than 1 minute read

Given a list of integers nums, return whether all numbers appear an even number of times.

This should be done in \(\mathcal{O}(1)\) space.

Constraints

  • n ≤ 100,000 where n is the length of nums

https://binarysearch.com/problems/Even-Frequency

Examples

Example 1

Input

  • nums = [2, 4, 4, 2, 3, 3]

Output

  • answer = True

Explanation

Every number occurs twice.

Example 2

Input

  • nums = [1]

Output

  • answer = False

Explanation

1 occurs an odd number of times.

Solution

Categories:

Updated:

Leave a comment