Reported May 2026
DoorDashgreedy

Maximize Total Profit by Assigning Chefs to Dishes

Reported by candidates from DoorDash's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live DoorDash OA. Under 2s to a working solution.
Founder's read

You've got a DoorDash OA in your inbox for May 2026. This is the classic chef-to-dish assignment problem, and it's testing whether you can think beyond brute force. Each chef has a skill level and can only complete dishes within their capability. Each dish has a difficulty and profit. The trick: you need to assign each chef to maximize total profit, but dishes can be done by multiple chefs. This is a greedy + sorting pattern, and it's easier than it looks once you see the pattern. StealthCoder will have your back if you freeze on the implementation.

The problem

Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem. Problem You are given three integer arrays: chefSkill: each chef's skill level dishDifficulty: each dish's difficulty dishProfit: the profit earned for completing that dish Rules: Each chef can complete at most one dish. A dish can be completed by multiple chefs (dishes are not exclusive). A chef can only complete dishes with difficulty <= their skill. Compute the maximum total profit by assigning each chef the best dish they can do. Example Input: chefSkill = [1,2,3] dishDifficulty = [1,2,3] dishProfit = [1,2,3] Output: 6 Explanation: each chef picks the most profitable dish they can do. Typical constraints (you may state/assume during the interview) 1 <= len(chefSkill), len(dishDifficulty), len(dishProfit) <= 2e5 values are non-negative integers and arrays may be unsorted. Task Return the maximum total profit as an integer. Example Input 3 1 2 3 3 1 2 3 Output 6 Function Description Complete solveMaximizeChefDishProfit. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters. The returned string array must match the expected standard output lines for the sample input. Use the limits and requirements stated in the prompt.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The greedy approach here is counter-intuitive at first: sort chefs by skill ascending, sort dishes by profit descending. Then iterate through each chef and assign them the most profitable dish they can do (difficulty <= their skill). The key insight is that a chef with lower skill should get priority on high-profit dishes if they can do them, because higher-skill chefs have more options. You'll need binary search (or two-pointer logic) to find the best dish each chef can handle, then track which dishes have been taken. The common mistake is trying to do a full matching algorithm instead of greedy assignment. If you blank during the OA, StealthCoder will show you the sorted structure and the binary search pattern to avoid the time complexity trap.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Maximize Total Profit by Assigning Chefs to Dishes cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as maximum profit in job scheduling. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass DoorDash's OA.

DoorDash reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximize Total Profit by Assigning Chefs to Dishes FAQ

Can a chef do a dish that's too hard for them?+

No. A chef can only complete dishes with difficulty less than or equal to their skill level. That's the hard constraint. If all available dishes are too hard, that chef gets nothing.

If a dish can be done by multiple chefs, how do I know who should do it?+

Greedy: whoever does it should be the chef with the lowest skill level who can do it. That frees up higher-skill chefs for harder, potentially more profitable dishes. Sort both arrays and iterate smartly.

What's the time complexity trap here?+

Brute force O(n*m) nested loop will time out. You need sorting plus binary search to get O((n+m) log m). Use binary search to find the hardest dish each chef can complete, then track assignments.

Do I need to track which chef did which dish, or just the total profit?+

Just the total profit. You don't return the assignment, only the maximum sum. That simplifies the code significantly and tells you greedy is the right approach.

Can I solve this in 48 hours if I haven't seen it before?+

Yes, if you recognize the pattern: sort, greedy selection, binary search for feasibility. The pattern appears in multiple OAs. If you see chef-dish or job-worker assignment, think sorted greedy plus binary search immediately.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with DoorDash.

OA at DoorDash?
Invisible during screen share
Get it