leetcode

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

2001.cpp (316B)


      1 class Solution {
      2   public:
      3     long long interchangeableRectangles(const vector<vector<int>> &rectangles) const {
      4         unordered_map<double, int> um;
      5         long long res = 0;
      6 
      7         for (const auto &rec : rectangles) {
      8             res += um[(double)rec[0] / rec[1]]++;
      9         }
     10 
     11         return res;
     12     }
     13 };