Square Root Using Binary Search
Easyjavapythonccppjavascript
Given a non-negative integer N, find the integer part of its square root without using a built-in square-root function.
Input Format
A single line containing the integer N.
Output Format
Print floor(sqrt(N)).
Example 1
Input
20
Output
4
Explanation: 4*4 = 16 and 5*5 = 25, so the integer square root is 4.
- 0 <= N <= 1000000000000