题目 题解 思路:双指针,取平方根的区间,首尾缩小窗口; class Solution: def judgeSquareSum(self, c: int) -> bool: i = 0 j = int(math.sqrt(c)) while i<= j: sum = i*i + j*j if sum > c: j -= 1 if sum < c: i += 1 if sum == c: break if sum == c: return True else: return False