Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1802. Maximum Value at a Given Index in a Bounded Array
Given n, index, and maxSum, find the largest possible value at nums[index] in a length-n array of positive integers where adjacent elements differ by at most 1 and the total sum ≤ maxSum. The key is to test candidate peak values (e.g., by binary search) and compute the minimal total sum formed by 1-step ramps (triangular/pyramid shapes) extending from that peak to both ends to check feasibility.
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.