```
class Solution:
# @param x, an integer
# @return an integer
def sqrt(self, x):
start=0
end=x
while start<=end:
mid=(start+end)/2
if mid*mid>x:
end=mid-1
else:
if (mid+1)*(mid+1)>x:
return mid
else:
start=mid+1
```