1207.cpp (443B)
1 class Solution { 2 public: 3 bool uniqueOccurrences(const vector<int> &arr) { 4 static int count[2001], seen[1001]; 5 memset(count, 0x00, sizeof(count)); 6 memset(seen, 0x00, sizeof(seen)); 7 for (const int n : arr) 8 count[n + 1000]++; 9 for (const int n : count) { 10 if (!n) continue; 11 if (seen[n]) return false; 12 seen[n] = 1; 13 } 14 return true; 15 } 16 };