367. 有效的完全平方数 发表于 2021-12-17 更新于 2022-10-29 分类于 leecode刷题复习 这是文章开头,显示在主页面,详情请点击此处。 12345678910111213class Solution: def isPerfectSquare(self, num: int) -> bool: left = 1 right = num while left<=right: half = left + (right-left)//2 if half*half == num: return True elif half*half > num: right = half - 1 else: left = half + 1 return False