Leetcode 2355. Maximum Number of Books You Can Take
Given an array of piles where each element is the number of books on a shelf, pick a contiguous segment and take books from right to left so that the number taken from each shelf is positive, at most the shelf count, and strictly decreases by at least 1 each step — maximize the total books taken. The core challenge is enforcing the decreasing-cap constraint efficiently (greedy/one-pass or monotonic strategy) over large inputs.
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.