leetcode

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

1860.cpp (352B)


      1 class Solution {
      2   public:
      3     vector<int> memLeak(int memory1, int memory2) {
      4         int time = 1;
      5         while (time <= memory1 || time <= memory2) {
      6             if (memory1 < memory2)
      7                 memory2 -= time;
      8             else
      9                 memory1 -= time;
     10             time++;
     11         }
     12         return {time, memory1, memory2};
     13     }
     14 };