Square Root of Integer


Given an integar A.

Compute and return the square root of A.

If A is not a perfect square, return floor(sqrt(A)).

DO NOT USE SQRT FUNCTION FROM STANDARD LIBRARY



Input Format

The first and only argument given is the integer A.

Output Format

Return floor(sqrt(A))

Constraints

1 <= A <= 10^9

For Example

Input 1:
    A = 11
Output 1:
    3

Input 2:
    A = 9
Output 2:
    3
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Square Root of Integer on Interview Code Editor
Sign Up
to access hints and editorial solutions for Square Root of Integer

Discussion


Loading...
Click here to start solving coding interview questions