Talentd
FleetCode

633. Sum of Square Numbers

Medium37.0% acceptance6 companies

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

Example 1:

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

Example 2:

Input: c = 3
Output: false

Constraints:

  • 0 <= c <= 231 - 1
14:26
Still stuck?Read 4 approaches, or watch a walkthrough.
Open solution
Loading editor…
1class Solution:
2 def judgeSquareSum(self, c: int) -> bool:
3
Starter codePython 3Spaces: 4
Examples
Input
5
Input
3
Your code is saved on this device.Solution