We’re preparing your current view and syncing the latest data.
Given a non-negative integer c, determine whether there exist two integers a and b such that a² + b² = c.
Return true if such a pair exists, otherwise, return false.
A single non-negative integer c.
Return true if there exist integers a and b such that a² + b² = c; otherwise, return false.
0 <= c <= 2^31 - 1
Example 1
Input
5
Output
true
Explanation
1² + 2² = 1 + 4 = 5
Example 2
Input
3
Output
false
Explanation
No integers a and b satisfy a² + b² = 3