Skip to content

Commit

Permalink
添加 1207.独一无二的出现次数python3版本
Browse files Browse the repository at this point in the history
  • Loading branch information
ironartisan committed Aug 7, 2021
1 parent b86c096 commit 6608331
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion problems/1207.独一无二的出现次数.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,21 @@ class Solution {
```

Python:

```python
class Solution:
def uniqueOccurrences(self, arr: List[int]) -> bool:
count = [0] * 2002
for i in range(len(arr)):
count[arr[i] + 1000] += 1 # 防止负数作为下标
freq = [False] * 1002 # 标记相同频率是否重复出现
for i in range(2001):
if count[i] > 0:
if freq[count[i]] == False:
freq[count[i]] = True
else:
return False
return True
```
Go:

JavaScript:
Expand Down

0 comments on commit 6608331

Please sign in to comment.