commit
d1687d819f
|
@ -127,7 +127,7 @@ public int arrangeCoins(int n) {
|
|||
int l = 0, h = n;
|
||||
while(l <= h){
|
||||
int m = l + (h - l) / 2;
|
||||
long x = m * (m + 1L) / 2;
|
||||
long x = m * (m + 1) / 2;
|
||||
if(x == n) return m;
|
||||
else if(x < n) l = m + 1;
|
||||
else h = m - 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user