Skip to content

Commit 86cbaaf

Browse files
authored
Create Solution.java
1 parent 1d4912a commit 86cbaaf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public boolean isPerfectSquare(int num) {
3+
long r = num;
4+
while (r * r > num) {
5+
r = (r + num / r) / 2;
6+
}
7+
return r * r == num;
8+
}
9+
}

0 commit comments

Comments
 (0)