Write a program to compute and return the square root of an integer
num
.
Problem Note
-
Where
num
is guaranteed to be a non-negative integer. -
If
num
is not a perfect square, then return floor(√num
)
Example 1
Input: 4
Output: 2
Explanation: The square root of 4 is 2 as it is a perfect square.
Example 2
Input: 11
Output: 3
Explanation: The square root of 11 is 3.3166….., and since 11 is not a perfect square, then return only integer part of it.