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
4mo

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

Help your peers!
Select
Add answer anonymously...

Google Software Developer Intern interview questions & answers

A Software Developer Intern was asked Q. Majority Element - II Problem Statement Given an array/list ARR of integers with...read more
A Software Developer Intern was asked Q. Consecutive Elements Given an array arr of N non-negative integers, determine wh...read more
A Software Developer Intern was asked Q. Minimum Removals Problem Statement Given an integer array ARR of size N and an i...read more

Popular interview questions of Software Developer Intern

A Software Developer Intern was asked Q1. Majority Element - II Problem Statement Given an array/list ARR of integers with...read more
A Software Developer Intern was asked Q2. Consecutive Elements Given an array arr of N non-negative integers, determine wh...read more
A Software Developer Intern was asked Q3. Minimum Removals Problem Statement Given an integer array ARR of size N and an i...read more
Google Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits