1class Solution {2public:3bool judgeSquareSum(int c) {4long long start = 0, end = 0;5while (end * end < c) {6end++;7}8long long target = c;9while (start <= end) {10long long product = start * start + end * end;11if (product == target) {12return true;13} else if (product > c) {14end--;15} else {16start++;17}18}19return false;20}21};