633. Sum of Square Numbers
202407021414
tags: #binary-search
var judgeSquareSum = function(c) {
let small = 0;
let large = Math.floor(Math.sqrt(c));
while (small <= large) {
const res = small * small + large * large;
if (res === c) {
return true;
}
if (res < c) {
small += 1;
} else {
large -= 1;
}
}
return false;
};