Maximum Server Processing Time
Updated
Problem statement
An array processTime lists tasks in a fixed order. Split it into exactly numServers nonempty contiguous blocks, with every block containing at least m tasks.
A server's processing time is the sum of the m largest task times in its block. The servers execute sequentially, so the total processing time is the sum of their processing times. Return the maximum possible total.
Function
maxServerProcessingTime(processTime: int[], numServers: int, m: int) → longExamples
Example 1
processTime = [1,3,5,2,7,1,5,9]numServers = 3m = 2return = 31One optimal split has block scores 8, 9, and 14, totaling 31.
Example 2
processTime = [4,1,8,2]numServers = 2m = 1return = 12The two globally largest times, 8 and 4, can be captured in separate blocks.
Example 3
processTime = [5,2,7,3]numServers = 1m = 2return = 12With one block, the two largest task times sum to 12.
Constraints
1 <= numServers, mnumServers * m <= processTime.length <= 2 * 10^51 <= processTime[i] <= 10^9
More Arista Networks interview questions
- First Missing Number in a Consecutive ArrayOA · PHONE SCREEN · Seen Oct 2026
- API Bandwidth AllocationOA · Seen Sep 2026
- LFU CacheOA · Seen Sep 2026
- Minimum Adjacent Merges to Form a PalindromeOA · Seen Aug 2026
- Generate Matrix BOA · Seen Jun 2021
- Remove All Repeated Values from a Linked ListPHONE SCREEN · Seen Oct 2026
- Trace Nested Object Destruction OrderPHONE SCREEN · Seen Oct 2026
- Trace Pointer Rebinding and Pointee UpdatesPHONE SCREEN · Seen Oct 2026
- Swap Adjacent NibblesPHONE SCREEN · Seen Aug 2026
- Unique Target-Sum Pairs in a Sorted Doubly Linked ListPHONE SCREEN · Seen Aug 2026
Similar questions at other companies
- Hard Disk Clustering CostConfluent · OAConfluent interview questions
- Maximize K-Element AND with an Increment BudgetAmazon · OA
- Delete and Freeze GameRubrik · OARubrik interview questions
- Most Segments That Sort the ArrayRippling · OARippling interview questions
- IPO Share AllocationTwo Sigma · OATwo Sigma interview questions
- Most Items Within Budget from a Start IndexHudson River Trading · OAHudson River Trading interview questions
- Divide Tree NodesGoogle · OA · ONSITE INTERVIEWGoogle interview questions
- Minimum Satellite Data Transfer IterationsHSBC · OAHSBC interview questions
- Initial Public OfferingPoint72 · OAPoint72 interview questions
- Luna and the Colorful SocksPhonePe · OAPhonePe interview questions