Integer square root Newton

Write codeMedium20 minAmazon and Bloomberg style

Your task

Compute the integer square root of a non-negative integer x WITHOUT using any floating point (no math.sqrt, no **0.5): return the largest integer r such that r*r <= x. Use Newton's method (integer iteration). Constraints: 0 <= x <= 10^18. Example: isqrt(8) = 2, isqrt(16) = 4.

Examples

integer_sqrt(x: int) -> int
Example 1
Inputinteger_sqrt(8)
Output2