Skip to content

826. Most Profit Assigning Work #186

Discussion options

You must be logged in to vote

We need to assign workers to jobs in such a way that each worker can only do jobs they are capable of based on their ability (which means their ability must be greater than or equal to the job's difficulty). The goal is to maximize the total profit, and one job can be completed multiple times by different workers.

Plan:

  1. Sort the jobs by difficulty so that we can match workers to the most profitable job they can do.
  2. Sort the workers by their ability, so that we can easily assign the best job to each worker.
  3. Use a greedy strategy: For each worker, find the highest profit they can earn from jobs whose difficulty is less than or equal to their ability.

Steps:

  1. Combine the difficulty and pro…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mah-shamim
Comment options

mah-shamim Sep 17, 2024
Maintainer Author

@basharul-siddike
Comment options

Answer selected by mah-shamim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants