Easy · Math
Square root
Given a non-negative integer x, return its integer square root: the largest integer r with r² ≤ x (√x rounded down), without using a built-in square-root or power function.
Examples
Example 1
x = 16Output: √ = 4
Example 2
x = 8Output: √ = 2
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.