You are viewing a single comment's thread. Return to all comments →
import bisect def minimumLoss(price): min_price = float('inf') sorted_price = [] for num in price: idx = bisect.bisect_right(sorted_price, num) if idx < len(sorted_price): min_price = min(min_price, sorted_price[idx] - num) sorted_price.insert(idx, num) return min_price
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 →