You are given an integer array nums indexed starting at
In a single move, you can perform either of the following operations:
If the pile is not empty, remove the topmost element from the pile.
If at least
You are also given an integer k, representing the total number of moves you must perform.
Return the maximum possible value of the topmost element of the pile after executing exactly k moves. If it is impossible to have any elements remaining in the pile after k moves, return
Constraints:
nums.length
nums[i], k
You are given an integer array nums indexed starting at
In a single move, you can perform either of the following operations:
If the pile is not empty, remove the topmost element from the pile.
If at least
You are also given an integer k, representing the total number of moves you must perform.
Return the maximum possible value of the topmost element of the pile after executing exactly k moves. If it is impossible to have any elements remaining in the pile after k moves, return
Constraints:
nums.length
nums[i], k