<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>

import math

class Solution:
    def judgeSquareSum(self, c: int) -> bool:
        # if the square root of c is an int, return true given that 0 and sqrt(c) summed is c
        if math.sqrt(c).is_integer() == True:
            return True
        # otherwise, round up and use that as your upper bound to binary search on
        else:
            possibles = list(range(1, math.ceil(math.sqrt(c))))
        
        print(possibles)
        # two pointer search for sum
        leftBound = 0
        rightBound = len(possibles)-1
        while leftBound <= rightBound:
            curr_sum = (possibles[leftBound]**2) + (possibles[rightBound]**2)
            if curr_sum == c:
                return True
            elif (curr_sum > c):
                rightBound -= 1
                continue
            else:
                leftBound +=1
                continue
        return False




        
19200