Skip to content

Commit 493c17b

Browse files
authored
Merge pull request #73 from Prabhjout/master
Added LeetCode 1860
2 parents 032f5fa + 44adf0c commit 493c17b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
vector<int> memLeak(int memory1, int memory2) {
4+
int flag1=0,flag2=0,flag3=0;
5+
for(int i=1;;i++){
6+
if(memory1>=memory2){if(i<=memory1)memory1-=i;else flag1=1,flag2=1;}else{
7+
if(i<=memory2)memory2-=i;else flag1=1,flag2=1;
8+
}
9+
10+
if(flag1==1&&flag2==1){flag3=i;break;}
11+
12+
}
13+
return {flag3,memory1,memory2};
14+
}
15+
};

0 commit comments

Comments
 (0)