Company: Publicis_Sapient_9_jan
Difficulty: medium
Shader Loader Description A game renders shaders using two GPUs, a and b . The string shader records which GPU is used for each shader: shader[i] = 'a' means GPU a renders the i -th shader, and shader[i] = 'b' means GPU b renders it. The idleness of this dual GPU system is the maximum number of consecutive shaders rendered by the same GPU, that is, the length of the longest block of equal characters in shader . For example, in shader = "aabbba" GPU a is used for 2 consecutive shaders, then GPU b for 3, then GPU a for 1. The idleness of this system is 3 . To reduce idleness, you can perform the following operation at most switchCount times: Select any index i and change shader[i] from 'a' to 'b' or from 'b' to 'a' . Find the minimum possible idleness that can be achieved by applying these operations optimally. You do not have to use all switchCount operations. Function Description Complete the function findMinimumIdleness with the following parameters: string shader : the GPU used for e