Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2202. Maximize the Topmost Element After K Moves
Given an array where nums[0] is the top of a pile and in each move you may either pop the top or push back any previously removed element, compute the maximum possible top element after exactly k moves (or -1 if you cannot end with a non-empty pile). The core challenge is choosing which prefix elements to remove and which removed element (if any) to restore — only the first min(n, k+1) elements matter, with special-edge cases when n=1 or k is small.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.