Adjust Prices

From Doordash interviews: a coding interview problem where you’re given an array of item prices and a list of queries. Each query either sets the price of item x to v or raises all prices below v to v. Apply all queries and output the final prices. This interview question focuses on processing array updates.

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: