Company: UIpath_5sep
Difficulty: medium
FindMinIncrease Problem Description A team needs to optimize context switching between processes. There are `n` segments, each assigned a thread. The maximum stack size of a thread in the `j th ` segment is given by `threadSize[j]` for all `0 For any high-priority process, the stack size of some segments must be increased. A segment `i` is considered special if `threadSize[i-1] threadSize[i+1]`. The segments at each end (first and last) cannot be special. The goal is to modify the stack sizes to maximize the number of special segments. To achieve this: Select an index `x` and an integer `v`, where `0 Increase the stack size of the `x th ` segment from `threadSize[x]` to `threadSize[x] + v`. Determine the minimum total increase in the stack size required to maximize the number of special segments. Function Description Complete the function `findMinIncrease` in the editor with the following parameters: `int threadSize[n]`: the stack sizes for the threads to be assigned to the segments. R