Problem Description
Given an integer 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.
NOTE: Do not use sort function from standard library. Users are expected to solve this in O(log(A)) time.
The first and only argument given is the integer A.
Return floor(sqrt(A))
Input 1:
11
Input 2:
9
Output 1:
3
Output 2:
3
Explanation:
When A = 11 , square root of A = 3.316. It is not a perfect square so we return the floor which is 3. When A = 9 which is a perfect square of 3, so we return 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 question? Checkout Sample Codes for more details.