Company: Uber Oncampus_19july
Difficulty: medium
Uber maintains a minute-by-minute log of how many active driver support chats are handled by the system, stored in the array chatLoad , where chatLoad[i] represents the number of support chats at the i-th minute. During a support system audit, the operations team is given a list of k specific minutes (in the array reviewMinutes ) when spikes in driver support activity were reported. They want to investigate the chat volume between selected pairs of these minutes. Each investigation works as follows: Choose any two different positions i and j from reviewMinutes (0 <= i < j < len(reviewMinutes)). Let start = min(reviewMinutes[i], reviewMinutes[j]) and end = max(reviewMinutes[i], reviewMinutes[j]) . Add up the total chat load from minute start to end (inclusive), i.e. chatLoad[start..end] . Remove both entries i and j from reviewMinutes . Repeat until exactly k / 2 such investigations are done. Perform exactly k / 2 such investigations by choosing pairs optimally in such a way th