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.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.