We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4c2223b commit b7f54a7Copy full SHA for b7f54a7
C++/sum-of-square-numbers.cpp
@@ -6,7 +6,7 @@ class Solution {
6
bool judgeSquareSum(int c) {
7
for (long long a = 0; a * a <= c; ++a) {
8
auto b = static_cast<int>(sqrt(c - a * a));
9
- if (c - a * a == b * b) {
+ if (a * a + b * b == c) {
10
return true;
11
}
12
0 commit comments