Company: AT&T
Difficulty: medium
You need to select exactly k servers from a sequence of n servers, where each server has a vulnerability value. The vulnerability of your chosen set is defined as the maximum vulnerability value among the selected servers. Select exactly k servers from a sequence of n servers such that: No two adjacent servers are chosen. The vulnerability of the selected servers is minimized. Example n = 4 k = 2 vulnerability = [2, 3, 5, 9] There are 3 possible subsequences of k = 2 non-adjacent servers: [2, 5] - max vulnerability = 5 [3, 9] - max vulnerability = 9 [2, 9] - max vulnerability = 9 The minimum vulnerability is 5. Function Description Complete the function getMinVulnerability in the editor with the following parameters: int vulnerability[n] : An array of integers int k : the length of the subsequences to form Returns int : the minimum value returned by the max function for all valid subsequences Constraints 1 ≤ n ≤ 10 5 1 ≤ vulnerability[i] ≤ 10 9 1 ≤ k ≤ ( n + 1) / 2 In