Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 869df5c

Browse files
authored
Update and rename Sum of square numbers.java to Sum of Square Numbers.java
1 parent 5468fa2 commit 869df5c

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

Easy/Sum of Square Numbers.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public boolean judgeSquareSum(int c) {
3+
int left = 0;
4+
int right = (int) Math.sqrt(c);
5+
while (left <= right) {
6+
int currSquareSum = left * left + right * right;
7+
if (currSquareSum < c) {
8+
left++;
9+
} else if (currSquareSum > c) {
10+
right--;
11+
} else {
12+
return true;
13+
}
14+
}
15+
return false;
16+
}
17+
}

Easy/Sum of square numbers.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)