1207. Unique Number of Occurrences Easy
1/**
2 * [1207] Unique Number of Occurrences
3 *
4 * Given an array of integers arr, return true if the number of occurrences of each value in the array is unique, or false otherwise.
5 *
6 * Example 1:
7 *
8 * Input: arr = [1,2,2,1,1,3]
9 * Output: true
10 * Explanation: The value 1 has 3 occurrences, 2 has 2 and 3 has 1. No two values have the same number of occurrences.
11 * Example 2:
12 *
13 * Input: arr = [1,2]
14 * Output: false
15 *
16 * Example 3:
17 *
18 * Input: arr = [-3,0,1,-3,1,1,1,-3,10,0]
19 * Output: true
20 *
21 *
22 * Constraints:
23 *
24 * 1 <= arr.length <= 1000
25 * -1000 <= arr[i] <= 1000
26 *
27 */
28pub struct Solution {}
29
30// problem: https://leetcode.com/problems/unique-number-of-occurrences/
31// discuss: https://leetcode.com/problems/unique-number-of-occurrences/discuss/?currentPage=1&orderBy=most_votes&query=
32
33// submission codes start here
34
35impl Solution {
36 pub fn unique_occurrences(arr: Vec<i32>) -> bool {
37 false
38 }
39}
40
41// submission codes end
42
43#[cfg(test)]
44mod tests {
45 use super::*;
46
47 #[test]
48 fn test_1207() {
49 }
50}
51
Back
© 2025 bowen.ge All Rights Reserved.