Skip to main content
Advancedcoding Verified

N APIs each have a fixed runtime budget in minutes and M applications must run simultaneously; an application can switch APIs at any time. Find the maximum number of minutes all M can run together.

ReportedSource: GeeksforGeeks interview experience: Flipkart SDE-1 off-campus 2024

Quick answerFree

Binary search T: feasible if sum(min(budget, T)) >= M·T. Or greedily dedicate the largest budgets while they exceed the average, then answer = remaining total / remaining M.

Detailed answer· ~130 words

Pro

Unlock the full answer with Pro

Get a ~130-word model answer and a runnable reference solution, plus 34 more Algorithms questions.

Reference solution· runs in the browser sandbox

Pro
Unlock with Pro

+ 34 more Algorithms questions in Pro, each with the full answer.

Discussion