Minimum Time To Solve The Problems
Given 'N' subjects, each containing a certain number of problems, and 'K' friends, assign subjects to friends such that each subject goes to exactly one friend, maintaining contiguity in assignment, aiming to minimize the maximum number of problems any single friend receives. Each problem takes 1 unit of time to solve. Determine the minimum possible time required for the most loaded friend.
Example:
Input:
N = 4
K = 2
subjects = {50, 100, 300, 400}
Output:
400
Explanation:
The optimal assignment of subjects is {50, 100, 300} for the first friend and {400} for the second friend. The maximum time any friend takes in this setup is 400, which is minimal.
Constraints:
1 <= T <= 10
1 <= N, K <= 10^4
1 <= subjects[i] <= 10^9
- Time limit: 1 second
Assign subjects to friends to minimize maximum workload, find minimum time for most loaded friend.
Sort subjects in descending order
Assign subjects to friends one by one until all subjects are assigned...read more
Top Google Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
Top HR questions asked in Google Software Developer Intern
Reviews
Interviews
Salaries
Users/Month