Incremental Memory Leak LeetCode solution in Java

1
class Solution {
2
public int[] memLeak(int memory1, int memory2) {
3
int i = 1;
4
while (Math.max(memory1, memory2) >= i) {
5
if (memory1 >= memory2) memory1 -= i;
6
else memory2 -= i;
7
i++;
8
}
9
return new int[] {i, memory1, memory2};
10
}
11
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0