Company: Visa
Difficulty: hard
Minimum Peak GPU Usage A rendering farm owns exactly two GPUs, A and B . A finished job log is written as a string s of length n made only of the characters 'A' and 'B' : the character s[i] is the GPU that was used during the i -th time unit. Running the same GPU for many consecutive time units overheats it, so the operators want to rewrite the schedule. Rewriting one time unit means switching the GPU used at that position: 'A' becomes 'B' 'B' becomes 'A' At most k positions may be rewritten. Positions may be chosen freely and independently. For any schedule, its maximum continuous usage is the length of the longest block of consecutive equal characters in it. Rewrite at most k positions so that the maximum continuous usage of the resulting schedule is as small as possible, and report that smallest possible value. Function description Complete the minimizeMaxUsage function provided in the editor. It takes the following parameters and returns an integer, the minimum achievable maximum c