Skip to content

Commit 8ae924d

Browse files
authored
Upload solution2 to 0069 with python2 - 28ms
1 parent b6b5f8d commit 8ae924d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

solution/0069.sqrt-x/Solution2.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Newton's Method [python2] - 28ms
2+
3+
class Solution(object):
4+
def mySqrt(self, x):
5+
r = x
6+
while r * r > x:
7+
r = (r + x/r)/2
8+
9+
return r

0 commit comments

Comments
 (0)