Very easy python NLogN


#1
def isValid(bladeLength,a,b):
    cutTree=0
    for i in a:
        if i>bladeLength:
            cutTree+=(i-bladeLength)
    return cutTree>=b


class Solution:
    # @param A : list of integers
    # @param B : integer
    # @return an integer
    def solve(self, a,b):
        low,high=0,max(a)
        res=-1
        while low<=high:
            mid=low+(high-low)//2
            if isValid(mid,a,b):
                res=mid
                low=mid+1
            else:
                high=mid-1
        return res

#2

how did you cal time comp for this solution, can you explain the process of calculation of time comp in detail