This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long long cube_root(long long x) { | |
long long l = 0, r = 1000005; // set the maximum right boundary here. | |
while(l != r) { | |
long long mid = (l + r + 1) / 2; | |
if(mid * mid * mid > x) | |
r = mid - 1; | |
else | |
l = mid; | |
} | |
return l; |