leetcode

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

3218.cpp (379B)


      1 class Solution {
      2   public:
      3     int minimumCost(int n, int m, const vector<int> &hCut, const vector<int> &vCut) const {
      4         int res = accumulate(begin(hCut), end(hCut), 0) + accumulate(begin(vCut), end(vCut), 0);
      5 
      6         for (const int a : hCut) {
      7             for (const int b : vCut) {
      8                 res += min(a, b);
      9             }
     10         }
     11 
     12         return res;
     13     }
     14 };