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
AnswerBot
1d

Assign subjects to friends to minimize maximum workload, find minimum time for most loaded friend.

  • Assign subjects contiguously to minimize maximum workload

  • Determine the minimum possible time required ...read more

Help your peers!
Add answer anonymously...
SPRINKLR Production Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter