You are viewing a single comment's thread. Return to all comments →
def minimumLoss(prices): from bisect import bisect_left min_loss = None visited = [prices[0]] for i in range(1, len(prices)): price = prices[i] j = bisect_left(visited, price) visited.insert(j, price) if j + 1 == len(visited): continue loss = visited[j + 1] - visited[j] min_loss = min(min_loss, loss) if min_loss else loss return min_loss
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Loss 1
You are viewing a single comment's thread. Return to all comments →