Get Max Throughput
Updated
Problem statement
A data processing pipeline consists of n services connected in a series where output
of the ith service serves as the input of the (i + 1)th service. However, the processing
units have varying latenciesl, and the throughput of the ith units is represented by the array
throughput[i] in messages per minute. The first service receives input through an API, and the nth service
produces the final output.
Each service can be scaled up independently, with the cost of scaling up the ith service on unit equal
to scaling_cost[i]. After scaling up a service x times, it can process throughput[i] * (i + x) messages per minute.
Given the arrays throughput and scaling_cost, both of size n, and an integer budget representing
the budget available, determine the optimal scaling configuration for the services such that the
throughput generated by the nth service is maximized.
Complete the function getMaxThroughput in the editor 👉👉.
getMaxThroughput has the following parameters:
- 1.
int throughput[n]: the throughput generated by each of the n services - 2.
int scaling_cost[n]: the cost of scaling up a service one time - 3.
int budget: the available memory
long: the max value of the throughput generated at the end of the composite service after scaling within the budget.
Key insight:
- _consider all feasible sol'ns_
- Binary search across all possible throughput values, checking if can be attained within budget
Function
getMaxThroughput(throughput: int[], scaling_cost: int[], budget: int) → longExamples
Example 1
throughput = [4, 2, 7]scaling_cost = [3, 5, 6]budget = 32return = 10
To maximize the throughput of the final service, an optimal solution is: When these units are applied in series, they generate a throughput of 10 units, the max possible throughput given the budget. Hence the answer is 10.
Example 2
throughput = [7, 3, 4, 6]scaling_cost = [2, 5, 4, 3]budget = 25return = 9
To maximize the throughput of the final service, an optimal solution is:
Constraints
404 not found 🥲
More Citadel interview questions
- Merge Price-Delta FeedsPHONE SCREEN · Seen Dec 2026
- Speed Up a Slow FunctionOA · PHONE SCREEN · Seen Nov 2026
- Portfolio Tickers with Constant-Time Random PickPHONE SCREEN · Seen Nov 2026
- Square Root FunctionPHONE SCREEN · Seen Oct 2026
- Reachable Transfer PositionsPHONE SCREEN · Seen Oct 2026
- Spreadsheet Formula DependenciesPHONE SCREEN · Seen Oct 2026
- Possible MEX Values After One Optional IncrementOA · Seen Oct 2026
- Currency Arbitrage CyclePHONE SCREEN · Seen Sep 2026
- Order Book with Cancel by Order IDPHONE SCREEN · Seen Sep 2026
- Smart Queue of Latest PricesPHONE SCREEN · Seen Sep 2026
Similar questions at other companies
- Minimum BeautyBloomberg LP · OABloomberg LP interview questions
- Minimum Operations to Make a SubsequenceGoogle · OAGoogle interview questions
- Split Array to Minimize the Largest SumInfosys · OAInfosys interview questions
- Split Array Largest SumAuxoAI · OA
- Data ReorganizationGoldman Sachs · OAGoldman Sachs interview questions
- Find Minimum TimeRippling · OARippling interview questions
- Find Optimal LevelAmazon · OA
- Minimum Days to Target EngagementTikTok · OATikTok interview questions
- Job ExecutionSnowflake · OASnowflake interview questions
- Maximizing Difference in Array Elements with Moves 🐹Microsoft · OAMicrosoft interview questions
Citadel interview experiences
- Citadel Securities Quant Researcher Intern Loop: 1 Experience
- Citadel Securities Research Engineer Interview: 1 Experience
- Citadel Securities SWE Intern First Round: 2 Experiences
- Citadel Securities Experienced SWE Interviews: 1 Experience
- Citadel SWE Intern Later Rounds and Superday: 13 Experiences
- Citadel SWE Intern First-Round Questions: 20 Experiences