<p>Given a non-negative integer <code>c</code>, decide whether there&#39;re two integers <code>a</code> and <code>b</code> such that <code>a<sup>2</sup> + b<sup>2</sup> = c</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> c = 5
<strong>Output:</strong> true
<strong>Explanation:</strong> 1 * 1 + 2 * 2 = 5
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> c = 3
<strong>Output:</strong> false
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>0 &lt;= c &lt;= 2<sup>31</sup> - 1</code></li>
</ul>

class Solution {
public:
    bool judgeSquareSum(int c) {
        long long  size=ceil(sqrt(c))+1;
        vector<long long > precomputePower(size,0);
        for(long long  i=0;i<size;i++) {
            precomputePower[i]=i*i;
        }
        long long  l =0;
        long long  r = size-1;
        long long sum=0;
        while(l<=r) {
            sum = precomputePower[l]+precomputePower[r];
            if (sum==c) return true;
            if(sum<c) {
                l+=1;
            } else {
                r-=1;
            }
        }
        return false;
    }
};
16800