Sqrt(x) — Integer Root Problem

Sqrt(x) — Integer Root Problem — ExecCode Easy DSA Practice

Solve the Sqrt(x) — Integer Root problem on ExecCode. Free online easy DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given a non-negative integer x, return the square root of x rounded down to the nearest integer. You may not use built-in exponent functions.

Examples

Input x = 8; Output 2

Constraints

0 ≤ x ≤ 2^31 - 1

Practice Sqrt(x) — Integer Root free on ExecCode. Browse DSA problems, topic map, and placement guides.