69. Sqrt(x)

Practice Sqrt(x) for free on NudgeCode: Easy, Binary Search pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Given a non-negative integer x, return its square root rounded down to the nearest integer.

Do not use a built-in power or square-root function (such as x ** 0.5 or Math.sqrt).

Example

x = 8  ->  2    (the real root is 2.828...)

Constraints