Given an integer x. The task is to find the square root of x. If x is not a perfect square, then return floor(√x).
First line of input contains number of testcases T. For each testcase, the only line contains the number x.
For each testcase, print square root of given integer.
The task is to complete the function floorSqrt() which should return the square root of given number x.
Expected Time Complexity: O(log N).
Expected Auxiliary Space: O(1).
1 ≤ T ≤ 10000
1 ≤ x ≤ 107
Testcase 1: Since, 5 is not perfect square, so floor of square_root of 5 is 2.
Testcase 2: Since, 4 is a perfect square, so its square root is 2.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.