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

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Math problems