【每日一题】633. 平方数之和
https://leetcode-cn.com/problems/sum-of-square-numbers/
思路:二分法
class Solution {
public boolean judgeSquareSum(int c) {
int left = 0, right = (int)Math.sqrt(c);
while(left <= right){
int sum = left * left + right * right;
if(sum == c){
return true;
}
if(sum > c){
right --;
}
else{
left++;
}
}
return false;
}
}