Discount Events

Problem Overview

  • Task: Given item prices and update queries, compute the final price of each item after all adjustments.
  • Input/Output: Inputs are n, an int array price, q, and queries of form [type, x, v]; output is the final prices array.
  • Query rules: type 1 sets price[x] to v; type 2 raises every price less than v up to v.
  • Context: Models a store applying inflation-based price changes; 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: