Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c.

&nbsp;
Example 1:

Input: c = 5
Output: true
Explanation: 1 * 1 + 2 * 2 = 5


Example 2:

Input: c = 3
Output: false


&nbsp;
Constraints:


	0 &lt;= c &lt;= 231 - 1


import math

class Solution:
    def judgeSquareSum(self, c: int) -> bool:

        a = 0

        while a ** 2 <= c:
            b = math.sqrt(c - a ** 2)

            if b.is_integer():
                return True

            a += 1

        return False
class Solution {
    public boolean judgeSquareSum(int c) {
        long a = 0;
        long b = (long) Math.sqrt(c);

        while(a<=b){
            if(((a*a) + (b*b)) == c){
                return true;
            }
            else if((((a*a)+(b*b)) < c)){
                a++;
            }
            else{
                b--;
            }
        }
        return false;
    }
}
class Solution {
public:
    bool judgeSquareSum(int c) {
        long long start=0,end=0;
        while(end*end<c){
            end++;
        }
        long long target=c;
        while(start<=end){
            long long product=start*start+end*end;
            if(product==target){
                return true;
            } else if(product>c){
                end--;
            } else {
                start++;
            }
        }
        return false;
    }
};
var judgeSquareSum = function(c) {
	let a = 0;
	let b = Math.sqrt(c) | 0;

	while (a <= b) {
		const sum = a ** 2 + b ** 2;
		if (sum === c) return true;
		sum > c ? b -= 1 : a += 1;
	}
	return false;
};
Sum of Square Numbers