Get Number of Perfect Packaging
Problem Overview
- Count ways to label n parcels with 5 stamps so adjacent stamps increase, decrease, or just differ according to adjacent price comparisons.
- Input: prices[0..n-1]. Output: number of valid labelings modulo 1e9+7 (return 0 if none).
- Real-world context: Amazon parcel packaging where stamp labels must reflect price trends.
- Constraints: 1 ≤ n ≤ 1e5; 1 ≤ prices[i] ≤ 1e5.
- An Amazon interviews coding interview problem and common 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:
