Given chef expertise (dish each chef can make), chef profit per dish, and a list of dish orders, assign orders to chefs to maximize total profit.
Asked in the onsite coding 2 stage. Solution using TreeMap; similar to Most Profit Assigning Work.
Implement maximize_profit(expertise, profit, orders). expertise[i] is the minimum order difficulty chef i can handle, and profit[i] is that chef's profit for each assigned order. Each order can be assigned independently, and a chef may handle multiple orders. Return the maximum total profit.
def maximize_profit(expertise, profit, orders):