65. Sqrt(x)
EasyBinary Search
Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well. You must not use any built-in exponent function or operator.
Examples
Input: 8
Output: 2
Explanation: sqrt(8) = 2.82..., rounded down is 2.
Constraints
- 0 <= x <= 2^31 - 1
Loading...
Run checks all cases above. Submit evaluates all test cases.