mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
国外版
This commit is contained in:
31
算法题(国外版)/unique-number-of-occurrences.html
Normal file
31
算法题(国外版)/unique-number-of-occurrences.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<p>Given an array of integers <code>arr</code>, return <code>true</code> if the number of occurrences of each value in the array is <strong>unique</strong>, or <code>false</code> otherwise.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> arr = [1,2,2,1,1,3]
|
||||
<strong>Output:</strong> true
|
||||
<strong>Explanation:</strong> The value 1 has 3 occurrences, 2 has 2 and 3 has 1. No two values have the same number of occurrences.</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> arr = [1,2]
|
||||
<strong>Output:</strong> false
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> arr = [-3,0,1,-3,1,1,1,-3,10,0]
|
||||
<strong>Output:</strong> true
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= arr.length <= 1000</code></li>
|
||||
<li><code>-1000 <= arr[i] <= 1000</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user