Most Profit Assigning Work
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
There are n jobs: job i has difficulty difficulty[i] and pays profit[i]. There are also m workers, and worker j can only do a job whose difficulty is at most worker[j].
Each worker does at most one job, but the same job can be done by any number of workers, each earning its profit. A worker who can do no job earns 0.
Return the maximum total profit the workers can earn.
Examples
Constraints
- `n == difficulty.length == profit.length`
- `m == worker.length`
- `1 <= n, m <= 10^4`
- `1 <= difficulty[i], profit[i], worker[j] <= 10^5`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.