Company: Harness On campus Sdet_19march
Difficulty: medium
A fleet of AI agents processes streams of operational telemetry data. Each stream is a sequence of processing loads that must be divided into a fixed number of contiguous segments so that different agents can process each segment in parallel. If any single segment carries too much total load, that agent becomes a bottleneck and slows [unclear] pipeline. Given a stream of processing loads and a number of agents, split the stream into that many contiguous segments so that the maximum segment sum is minimized. Example loads = [5, 3, 8, 1] k = 2 All possible ways to split into 2 contiguous segments: [5] and [3, 8, 1] -> sums: 5, 12 -> max = 12 [5, 3] and [8, 1] -> sums: 8, 9 -> max = 9 [5, 3, 8] and [1] -> sums: 16, 1 -> max = 16 The second split has the smallest maximum. Return 9 Function Description Complete the function distributeLoad in the editor provided. distributeLoad has the following parameters: Function Parameters: loads[n] : the processing load of each unit of