leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1010.cpp (381B)


      1 class Solution {
      2   public:
      3     int numPairsDivisibleBy60(const vector<int> &time) const {
      4         static int count[60];
      5         int res = 0;
      6 
      7         memset(count, 0x00, sizeof(count));
      8         for (const int n : time) {
      9             const int rem = n % 60;
     10             res += rem == 0 ? count[0] : count[60 - rem];
     11             count[rem]++;
     12         }
     13 
     14         return res;
     15     }
     16 };