Door Dash Technical Round
Anonymous User
2792
Feb 15, 2022

At a DoorDash Kitchen, we hire chefs with different skill levels. Everyday, the chefs cook different types of dishes. Dishes are sold at different prices, have different profits and some are harder to make than others. The head chef has recently hired m new chefs. There are n types of dishes. The head chef needs to assign those new chefs to dishes in a way that maximizes the kitchen’s profit. You are given three arrays representing: chef’s skill level, dish profit, and dish difficulty (how hard it is to make a dish) where:
skill[j] is the skill level of the jth chef (the jth chef can only make a dish with difficulty at most skill[j]).
difficulty[i] and profit[i]are the difficulty and the profit of the ith dish
1 <= difficulty[i], profit[i], skill[j] <= 10^5
In other words, there is an upper bound on how high the profit, skill and difficulty can be and that upper bound is a constant.
Every chef can only be assigned to cook one dish, but multiple chefs can be assigned to a dish.
For example, if three chefs make the same dish that sells for 15.
Return the maximum profit DoorDash Kitchens makes after assigning the new chefs to cook dishes.

Input: difficulty = [2,4,6,8,10], profits = [10,20,30,40,50], skill = [4,5,6,7]
Output: 100
Explanation: Chefs are assigned dishes of difficulty [4,4,6,6] and a DoorDash Kitchen gets a profit of [20,20,30,30] separately.

Comments (5)