Sqrt of X Problem

Sqrt of X Problem — ExecCode School DSA Practice

Solve the Sqrt of X problem on ExecCode. Free online school DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given a non-negative integer X, compute and print its integer square root. Your task is to solve Sqrt of X. The result should be the largest integer y such that y*y <= X.

Examples

Input 4; Output 2. Input 8; Output 2

Constraints

0 <= x <= 2^31 - 1

Practice Sqrt of X free on ExecCode. Browse DSA problems, topic map, and placement guides.