# The guess API is already defined for you.# @param num, your guess# @return -1 if my number is lower, 1 if my number is higher, otherwise return 0# def guess(num):classSolution(object):defguessNumber(self,n):""" :type n: int :rtype: int """l=1r=nwhilel<=r:m=(l+r)/2ret=guess(m)ifret==0:returnmelifret<0:r=m-1else:l=m+1returnl