Your question is Write a Programming Function. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
UNT Health Science Center logistics routes connect campus locations through directed paths. Each route has a travel time and an operational cost. Find the fastest route from a source location to a destination while staying within a cost budget and using at most a specified number of time-reduction coupons.
A coupon may be applied to any traversed route and changes its travel time from time to max(1, floor(time / 2)). Each coupon can be used once, and unused coupons are allowed. Return the minimum travel time and one route achieving it. If no valid route exists, return [-1, []].
Implement route_with_budget(n, edges, start, destination, budget, coupons). n is the number of locations labeled 0 through n - 1. edges is a list of [from, to, time, cost] entries representing directed routes. Return [minimum_time, path], where path is a list of location IDs from start to destination.
def route_with_budget(n, edges, start, destination, budget, coupons):