Given a non-negative integer x, return the integer square root of x. The integer square root is the greatest integer y such that y × y = x. You must not use any built-in exponent or square root functions.
Example 1
Input: x = 4
Output: 2
Explanation: 2 × 2 = 4, so the integer square root is 2.
Example 2
Input: x = 8
Output: 2
Explanation: The square root of 8 is approximately 2.828, so the integer square root is 2.
Example 3
Input: x = 0
Output: 0
Explanation: The square root of 0 is 0.
Sign in to write, run, and submit your solution against the full test suite.