LeetCode: Find Sqrt(x)
Problem:
https://leetcode.com/problems/sqrtx/description/
Code:
class Solution:
def mySqrt(self, x: int) -> int:
if x <= 1:
return x
low, high = 1, x // 2
while low <= high:
mid = (low + high) // 2...
is-power-of-two.hashnode.dev2 min read