leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
1010.cpp (381B)
0 class Solution { 1 public: 2 int numPairsDivisibleBy60(const vector<int> &time) const { 3 static int count[60]; 4 int res = 0; 5 6 memset(count, 0x00, sizeof(count)); 7 for (const int n : time) { 8 const int rem = n % 60; 9 res += rem == 0 ? count[0] : count[60 - rem]; 10 count[rem]++; 11 } 12 13 return res; 14 } 15 };