Skip to content

2071. Maximum Number of Tasks You Can Assign #1629

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to determine the maximum number of tasks that can be assigned to workers given that each worker can use a pill to boost their strength. The solution involves using a binary search approach combined with a greedy algorithm to efficiently check if a certain number of tasks can be completed.

Approach

  1. Binary Search: We perform a binary search on the number of tasks (from 0 to the minimum of the number of tasks and workers) to determine the maximum number of tasks that can be assigned.
  2. Greedy Algorithm with Binary Search: For each midpoint value during the binary search, we check if it's possible to complete that number of tasks using the k strongest workers. This check is done using …

Replies: 1 comment 2 replies

Comment options

mah-shamim
May 1, 2025
Maintainer Author

You must be logged in to vote
2 replies
@kovatz
Comment options

kovatz May 1, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim May 1, 2025
Maintainer Author

Answer selected by kovatz
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 hard Difficulty
2 participants