首页 > 其他 > 详细

Leetcode-5205 Unique Number of Occurrences(独一无二的出现次数)

时间:2019-09-29 16:15:10      阅读:75      评论:0      收藏:0      [点我收藏+]
 1 typedef long long ll;
 2 #define _for(i,a,b) for(int i = (a);i < b;i ++)
 3 #define _rep(i,a,b) for(int i = (a);i > b;i --)
 4 #define INF 0x3f3f3f3f
 5 #define pb push_back
 6 #define maxn 10000
 7 
 8 class Solution
 9 {
10     public:
11         bool uniqueOccurrences(vector<int>& arr)
12         {
13             int Hash[2003];
14             memset(Hash,0,sizeof(Hash));
15             _for(i,0,arr.size())
16                 Hash[arr[i]+1000] ++;
17             
18             _for(i,0,2001)
19             {
20                 _for(j,i+1,2001)
21                 {
22                     if(Hash[i] && Hash[i]==Hash[j])
23                         return false;
24                 }
25             }
26             return true;
27         }
28 };

 

Leetcode-5205 Unique Number of Occurrences(独一无二的出现次数)

原文:https://www.cnblogs.com/Asurudo/p/11607861.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!