<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:
    def judgeSquareSum(self, c: int) -> bool:
        if float(c ** 0.5) == int(c ** 0.5):
            return True
        lst = []
        num = 1
        while num ** 2 < c:
            lst.append(num)
            num += 1
        l, r = 0, len(lst) - 1
        while l < r:
            total = lst[l] ** 2 + lst[r] ** 2
            if total == c:
                return True
            elif total > c:
                r -= 1
            elif total < c:
                l += 1
        if lst[l] ** 2 + lst[r] ** 2 == c:
            return True
        return False
18200