Skip to content

Practice Check if Any Element Has Prime Frequency

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#3591
LeetCode Problem

Check if Any Element Has Prime Frequency

Problem Statement

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.

Source: Check if Any Element Has Prime Frequency on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,2,3,4,5,4]
Output
true

# Example 2

Input
nums = [1,2,3,4,5]
Output
false

# Example 3

Input
nums = [2,2,2,4,4]
Output
true

Constraints

1 <= nums.length <= 100
0 <= nums[i] <= 100

Related LeetCode Problems

Practice more problems similar to Check if Any Element Has Prime Frequency.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.