Medium
LABMaximize Profit From Task Assignment
Assign workers to jobs they can do. Each job has difficulty and profit; return maximum total profit with each worker taking one job.
EXAMPLES
Example 1
Input
{
"difficulty": [
2,
4,
6,
8,
10
],
"profit": [
10,
20,
30,
40,
50
],
"worker": [
4,
5,
6,
7
]
}
Output
100FUNCTION SHAPE
difficulty: intArrayprofit: intArrayworker: intArray→intSOLUTION NOTE
Open on LeetCode ↗This is a fairly simple problem. Just handle it with greedy intuition. Obviously you want to pair the worker with the highest profit task they can do.