class Solution {
public boolean judgeSquareSum(int c) {
for(long a=0;a*a<=c;a++){
double b=Math.sqrt(c-a*a);
if(b==(int)b){
return true;
}
}
return false;
}
}
class Solution {
public boolean judgeSquareSum(int c) {
int low=0,high=(int)Math.sqrt(c);
while(low<=high){
if((low*low+high*high)<c){
low++;
}else if((low*low+high*high)>c){
high--;
}else{
return true;
}
}
return false;
}
}