Choose at least k houses from the row represented by nums, without choosing two adjacent houses. The capability of a choice is the largest amount in any chosen house. Return the smallest possible capability. The constraints guarantee that at least k nonadjacent houses can be chosen.
Example 1:
Input: nums = [4,1,7,2]
k = 2
Output: 2Explanation: Choose the houses at indices 1 and 3, with amounts 1 and 2. They are nonadjacent and their maximum amount is 2, the smallest achievable capability.
Example 2:
Input: nums = [6,3,8]
k = 1
Output: 3Explanation: Only one house is required, so choose the house containing 3. Its amount determines the capability.
Example 3:
Input: nums = [5,1,5]
k = 2
Output: 5Explanation: Choosing two nonadjacent houses forces the first and last houses, both containing 5. The middle house cannot be chosen with either neighbor.
Constraints:
1 <= nums.length <= 1000001 <= nums[i] <= 10000000001 <= k <= floor((nums.length + 1) / 2)