Maximum Number of Tasks You Can Assign
You have n tasks and m workers. Each task has a strength requirement stored in a 0-indexed integer array tasks, with the i^th task requiring tasks[i] strength to complete. The strength of each worker is stored in a 0-indexed integer array workers, with the j^th worker having workers[j] strength.
Each worker:
- Can only be assigned to a single task.
- Must have strength greater than or equal to the task's strength requirement, meaning
workers[j] >= tasks[i].
Additionally, you have pills magical pills that will increase a worker's strength by strength. You can decide which workers receive the magical pills, but you may only give each worker at most one magical pill.
Given the 0-indexed integer arrays tasks and workers, and the integers pills and strength, return the maximum number of tasks that can be completed.
tasks = [3,2,1], workers = [0,3,3], pills = 1, strength = 13tasks = [5,4], workers = [0,0,0], pills = 1, strength = 51Constraints
- n == tasks.length
- m == workers.length
- 1 <= n, m <= 5 * 10^4
- 0 <= pills <= m
- 0 <= tasks[i], workers[j], strength <= 10^9