Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] master from youngyangyang04:master #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 11 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Aug 3, 2023
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
9807ea6
Update 1143.最长公共子序列.md about rust
fwqaaq Jul 18, 2023
695f867
Update 1035.不相交的线.md about rust
fwqaaq Jul 18, 2023
1a2c911
添加 1207 独一无二的出现次数 Go 版本
wangben18 Jul 19, 2023
eb9c4e6
Update 0392.判断子序列.md about rust
fwqaaq Jul 23, 2023
503c83d
Update 0392.判断子序列.md
fwqaaq Jul 23, 2023
2f815bc
Merge branch 'master' into patch-48
fwqaaq Jul 30, 2023
5a80e1d
Merge pull request #2189 from fwqaaq/patch-48
youngyangyang04 Aug 3, 2023
197d6c5
Merge pull request #2190 from fwqaaq/patch-49
youngyangyang04 Aug 3, 2023
f08eaaa
Merge branch 'master' into master
youngyangyang04 Aug 3, 2023
13888a5
Merge pull request #2192 from wangben18/master
youngyangyang04 Aug 3, 2023
e23099f
Merge pull request #2197 from fwqaaq/patch-50
youngyangyang04 Aug 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions problems/1207.独一无二的出现次数.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,30 @@ function uniqueOccurrences(arr: number[]): boolean {
})
return countMap.size === new Set(countMap.values()).size;
};
```


### Go:
```Go
func uniqueOccurrences(arr []int) bool {
count := make(map[int]int) // 统计数字出现的频率
for _, v := range arr {
count[v] += 1
}
fre := make(map[int]struct{}) // 看相同频率是否重复出现
for _, v := range count {
if _, ok := fre[v]; ok {
return false
}
fre[v] = struct{}{}
}
return true
}
```




<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
Expand Down

AltStyle によって変換されたページ (->オリジナル) /