633. Sum of Square Numbers

two sum 的换壳题 ,只是把原有在数组有序下相加为定值变成了平方的和相加为定值。

class Solution {
    public boolean judgeSquareSum(int c) {
        int hi = (int)Math.sqrt(c);
        int lo = 0;
        while(lo<=hi)
        {
            int sum = hi*hi+lo*lo;
            if(sum==c)
                return true;
            else if (sum

你可能感兴趣的:(633. Sum of Square Numbers)