Simple Python 3 Solution without HEAP


#1
def solve(self, A, B):
        res = 0
        while B > 0:
            temp = max(A)
            i = A.index(temp)
            A[i] = A[i] - 1
            res += temp
            B -= 1
        return res