Skip to content

Commit 48300f3

Browse files
committed
Runtime: 0 ms (Top 100.00%) | Memory: 6.1 MB (Top 19.77%)
1 parent 3132ca4 commit 48300f3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/algorithms/F/Find Three Consecutive Integers That Sum to a Given Number/Find Three Consecutive Integers That Sum to a Given Number.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
// Runtime: 0 ms (Top 100.00%) | Memory: 6.1 MB (Top 19.77%)
12
class Solution {
23
public:
34
vector<long long> sumOfThree(long long num) {
45
//binary Search
5-
6-
long long lo = -1;// -1 becoz we have num == 0 as well if we put lo=0 then it will fail in 1 testcase
6+
7+
long long lo = -1;// -1 becoz we have num == 0 as well if we put lo=0 then it will fail in 1 testcase
78
long long hi = num;
89
while(lo<=hi){
910
long long mid = lo +(hi-lo)/2;
@@ -18,7 +19,7 @@ class Solution {
1819
lo = mid+1;
1920
}
2021
}
21-
22+
2223
return {};
2324
}
24-
};
25+
};

0 commit comments

Comments
 (0)