Get Maximum

Problem Overview

  • Select a contiguous subarray of piles and assign picked counts that strictly increase left to right, each not exceeding its pile, to maximize the total picked.
  • Input: array numProducts; Output: integer maximum products.
  • Constraints: 1 ≤ n ≤ 5000, 1 ≤ numProducts[i] ≤ 1e9.
  • Real-world context: Amazon Fresh stock clearance and orderly stacking.
  • Asked in Amazon interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: