#3591

Check if Any Element Has Prime Frequency

easy · 62.5% accepted · 67 likes · top 64%

array · hash table · math · counting · number theory

Description

You are given an integer array nums.

Return true if the frequency of any element of the array is prime, otherwise, return false.

The frequency of an element x is the number of times it occurs in the array.

A prime number is a natural number greater than 1 with only two factors, 1 and itself.

Solution