二分法
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
left = 1
right = num
while left <= right:
mid = (left + right) / 2
if mid * mid == num: #is a perfect square
return True
if mid * mid > num: #
right = mid-1
else:#
left = mid+1
return False