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 = 16

Output: √ = 4

Example 2

x = 8

Output: √ = 2

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Math problems