633. Sum of Square Numbers

class Solution:
    def judgeSquareSum(self, c: int) -> bool:
        i = 0
        j = int(math.sqrt(c))

        while i <= j:
            z = (i ** 2) + (j ** 2)
            if z == c:
                return True

            elif z < c:
                i += 1

            else:
                j -= 1

        return False