← 返回 apple 的题目列表Maximum Apples Before Rot
类型:qbank
Each day an apple tree grows `apples[i]` apples that rot after `days[i]`; eat at most one apple per day and maximize total apples eaten, including days after growth stops.
Examples
Example 1:
Input: apples = [1,2,3,5,2], days = [3,2,1,4,2]
Output: 7
Example 2:
Input: apples = [3,0,0,0,0,2], days = [3,0,0,0,0,2]
Output: 5
Constraints
n == apples.length == days.length
1 <= n <= 2 * 10^4
0 <= apples[i], days[i] <= 2 * 10^4
days[i] = 0 if and only if apples[i] = 0