Maximum Server Processing Time
Reported by candidates from Visa's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Visa reportedly asked this one in August 2026, and the trap is hiding in the constraints. Every server needs a contiguous block, at least m tasks, and every task must be used. A greedy that just grabs the biggest values will break the moment the blocks don't fit. It's a partition DP in disguise: split the array into numServer contiguous segments and score each by its top m values. If you blank on the setup during the OA, StealthCoder sits invisibly on your screen and gives you a working solution in real time. Read the problem twice before you code.
The problem
You are given numTasks tasks and numServer servers. The tasks must be assigned to the servers under the following conditions: Each server is assigned a contiguous block of tasks. Every task is assigned to exactly one server. Each server must be assigned at least m tasks. The processing time of task i is processTime[i]. For any server, its processing time is the sum of the m largest processing times among the tasks assigned to that server. The servers work sequentially: one server completes all of its assigned tasks before the next server begins. Determine the maximum total processing time required for all servers to complete all tasks. Complete the function getMaximumProcessingTime. The array processTime contains the processing times of the tasks, numServer is the number of servers, and m is the minimum number of tasks assigned to each server. Here, numTasks = processTime.length. Return the maximum total processing time. Function getMaximumProcessingTime(processTime: int[], numServer: int, m: int) → long Examples Example 1 processTime = [1, 3, 5, 2, 7, 1, 5, 9] numServer = 3 m = 2 return = 31 Here, numTasks = 8. A maximum-total assignment is: Server 1 handles tasks 1, 2, and 3. Its two largest processing times are 3 and 5, so its processing time is 8. Server 2 handles tasks 4, 5, and 6. Its two largest processing times are 2 and 7, so its processing time is 9. Server 3 handles tasks 7 and 8. Its two largest processing times are 5 and 9, so its processing time is 14. The total processing time is 8 + 9 + 14 = 31. Thus, the maximum total processing time is 31.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The core move is a DP over (servers used, tasks consumed). Define dp[s][i] as the best total using s servers on the first i tasks. Transition by choosing where the last block starts, j, with i - j >= m, and add the sum of the m largest values in processTime[j..i-1]. The pitfall is the cost of that segment sum. Recomputing it by sorting each segment is too slow on big inputs. You need a running structure, like a min-heap of size m as the segment grows, or precomputed costs per start index. Also watch the edge cases: numServer * m greater than the task count means no valid split, and the result needs a 64-bit type since the sums get large. Check your base cases against Example 1, which gives 31. If the DP transitions feel shaky under the clock, StealthCoder is the hedge that can hand you the full structure live during the OA.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Maximum Server Processing Time cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Visa's OA.
Visa reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Maximum Server Processing Time FAQ
How hard is the Visa Maximum Server Processing Time question really?+
It's medium to hard. The statement is long but the idea is a partition DP. The real difficulty is computing the top-m sum of each contiguous segment fast enough. If you've seen split-array style DP, the structure will feel familiar.
What's the trick to solving it?+
Treat it as splitting the array into exactly numServer contiguous blocks, each with length at least m. Use dp[servers][prefix] and try every valid last-block start. The block's value is the sum of its m largest elements, so maintain that incrementally instead of re-sorting.
What edge cases should I test?+
Test numServer * m greater than the task count, since no valid assignment exists. Test exactly numServer * m tasks, where every block is forced to length m. Test m equal to 1, and large values that overflow a 32-bit int. Use a long for the total.
Can a greedy approach work here?+
Not safely. Blocks must be contiguous and every task must be used, so grabbing the largest values independently ignores the block boundaries. A greedy can look right on the sample and fail elsewhere. DP is the reliable route.
How do I prepare in 48 hours?+
Practice one or two partition DP problems, like splitting an array into k groups. Then practice a sliding structure for top-k sums, such as a size-m min-heap. Finally, hand-trace the sample to confirm you get 31 before submitting.