Algorithm · Microsoft · Medium
You are given a row of n servers in a fixed order, where vulnerability[i] is the vulnerability value of server i. Your task is to pick exactly k of these servers under one restriction: no two of the picked servers may sit next to each other in the row (that is, indices i and i + 1 can never both be chosen). A selection is scored by the largest vulnerability value found among the servers it contains. Among all selections that obey the restriction, find the one with the…