Sqrt(x) Problem
Sqrt(x) Problem — ExecCode Easy DSA Practice
Solve the Sqrt(x) problem on ExecCode. Free online easy DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given a non-negative integer x, return the square root of x rounded down to the nearest integer. Your task is to the returned integer should be non-negative as well. You must not use any built-in exponent function or operator. - For example, do not use pow(x, 0.5) in c++ or x 0.5 in python. Return the required answer exactly as shown in the examples.
Examples
Input {"x": 4}; Output 2. Input {"x": 8}; Output 2
Constraints
0 <= x <= 2^31 - 1
Practice Sqrt(x) free on ExecCode. Browse DSA problems, topic map, and placement guides.