3591. Check if Any Element Has Prime Frequency Easy
1/**
2 * [3591] Check if Any Element Has Prime Frequency
3 *
4 * You are given an integer array nums.
5 * Return true if the frequency of any element of the array is prime, otherwise, return false.
6 * The frequency of an element x is the number of times it occurs in the array.
7 * A prime number is a natural number greater than 1 with only two factors, 1 and itself.
8 *
9 * <strong class="example">Example 1:
10 * <div class="example-block">
11 * Input: <span class="example-io">nums = [1,2,3,4,5,4]</span>
12 * Output: <span class="example-io">true</span>
13 * Explanation:
14 * 4 has a frequency of two, which is a prime number.
15 * </div>
16 * <strong class="example">Example 2:
17 * <div class="example-block">
18 * Input: <span class="example-io">nums = [1,2,3,4,5]</span>
19 * Output: <span class="example-io">false</span>
20 * Explanation:
21 * All elements have a frequency of one.
22 * </div>
23 * <strong class="example">Example 3:
24 * <div class="example-block">
25 * Input: <span class="example-io">nums = [2,2,2,4,4]</span>
26 * Output: <span class="example-io">true</span>
27 * Explanation:
28 * Both 2 and 4 have a prime frequency.
29 * </div>
30 *
31 * Constraints:
32 *
33 * 1 <= nums.length <= 100
34 * 0 <= nums[i] <= 100
35 *
36 */
37pub struct Solution {}
38
39// problem: https://leetcode.com/problems/check-if-any-element-has-prime-frequency/
40// discuss: https://leetcode.com/problems/check-if-any-element-has-prime-frequency/discuss/?currentPage=1&orderBy=most_votes&query=
41
42// submission codes start here
43
44impl Solution {
45 pub fn check_prime_frequency(nums: Vec<i32>) -> bool {
46 false
47 }
48}
49
50// submission codes end
51
52#[cfg(test)]
53mod tests {
54 use super::*;
55
56 #[test]
57 fn test_3591() {
58 }
59}
60Back
© 2026 bowen.ge All Rights Reserved.