Integer square root
Easybinary searchmath
Return the square root of x rounded down, without built-ins like sqrt or **.
Example 1
Input: x = 4 Output: 2
Example 2
Input: x = 8 Output: 2
The root is 2.82…, rounded down to 2.
Constraints
- 0 ≤ x ≤ 2³¹ − 1
Submit checks your solution against 8 tests, including hidden ones.
/**
* @param {int} x
* @return {int}
*/
function mySqrt(x) {
}