Incremental Memory Leak LeetCode solution in C++

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

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0