classSolution(object):defmySqrt(self, x):"""
:type x: int
:rtype: int
"""if x==0:return0if x==1or x==2or x==3:return1
left =0
right = x//2
mid = left +(right-left)//2while left<= right:if mid<= x/mid:
left = mid+1else:
right = mid-1
mid = left +(right-left)//2return left-1
classSolution(object):defclimbStairs(self, n):"""
:type n: int
:rtype: int
"""
previous,current =0,1for i inrange(n):
previous, current =current, previous+current
return current