0 like 0 dislike
706 views
| 706 views

0 like 0 dislike
1. You have 'x' jobs and 'y manpower(workers). you are given three array; jobs, payment and manpower
where:

jobs[m] and payment[m] are the difficulty and the payment for the mth job and
manpower[n] is the capacity of nth worker(i.e nth worker can only complete a job with diffculty atmost manpower[n])
Every manpower can be assigned at most one job, but one job can be completed multiple times.

for example, if three manpower attempt the same jobs that pays \$2 then total profit will be \$6. if manpower cannot complete any jobs, their profit is \$0.

Return the maximum payment we can achieve after assigning manpower to the jobs.

Example:
input: jobs=[2,4,6,8,10], payment=[10,20,30,40,50], manpower=[4,5,6,7]
output:100
explantion: Manpowers are assinged jobs of difficulty [4,4,6,6] and they get payment of [20,20,30,30] separately.

example 2:
input: jobs=[85,47,57], payment=[24,66,99], manpower=[40,25,25]
output:0.

does any one know soultion for this question.

other 2 question similar to below,
2) https://leetcode.com/problems/stickers-to-spell-word/
3) https://leetcode.com/problems/friends-of-appropriate-ages/

by Expert (111,530 points)
0 like 0 dislike
this can be solved using binary search+computing the maximum payment till particular strength
by Expert (111,530 points)