Leetcode-5205 Unique Number of Occurrences(独一无二的出现次数)
作者:互联网
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 };
标签:arr,Hash,int,Number,long,2001,5205,Occurrences,define 来源: https://www.cnblogs.com/Asurudo/p/11607861.html