Adjust Prices 🍱
Updated
Problem statement
A general store at hackerland sells n items with the price of the ith item represented by price[i]. The store adjusts the price of the items based on inflation as queries of two types:
- 1.
1 x v: change the price of thexth item tov. - 2.
2 v v: change any price that is less thanvtov.
Given an array price of n integers and the price adjustment queries are in the form of a 2-d array where query[i] consists of 3 integers, find the final prices of all the items.
Function
adjustPrices(price: int[], queries: int[][]) → int[] Complete the func adjustPrices in the editor 👉
adjustPrices has the following parameter(s):
int price[n]: an arr of integersint queries[q][3]: A 2-d arr of ints
GG, spike! ٩(^ᗜ^ )و ´-
Examples
Example 1
price = [5, 7, 2]queries = [[2, 6, 6]]return = [6, 7, 6]
The result would be [6, 7, 6] since you update the 5 and the 2 as they are less than 6.
Example 2
price = [7, 5, 4]queries = [[2, 6, 6], [1, 2, 9], [2, 8, 8]]return = [8, 9, 8][2, 6, 6] - change elements < 6 to 6. now arr = [7, 6, 6] [1, 2, 9] - change the second element to 9, arr = [7, 9 6] [2, 8, 8] - change elements < 8 to 8. Finally arr = [8, 9, 8]
Constraints
Unknown for now 🍭
More DoorDash interview questions
- Customer Bootstrap APIPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Warehouse Order PrioritizationPHONE SCREEN · Seen Nov 2026
- Random Dasher Set OperationsONSITE INTERVIEW · Seen Nov 2026
- Dasher Pay with Store Waits and Peak HoursPHONE SCREEN · Seen Nov 2026
- Team FormationOA · Seen Oct 2026
- Simulate an Idempotent Refund Service FlowONSITE INTERVIEW · Seen Sep 2026
- Dasher Active TimePHONE SCREEN · Seen Sep 2026
- First Unique ID in a StreamONSITE INTERVIEW · Seen Aug 2026
- Minimum Parenthesis Removals and Their IndicesONSITE INTERVIEW · Seen Aug 2026
- Minimum Processing Speed with Multiple RidersONSITE INTERVIEW · Seen Aug 2026
Similar questions at other companies
- Photo AlbumHonda R&D · OA
- Rolling MetricsAkuna Capital · OAAkuna Capital interview questions
- Minimum Bridge TurnbacksBNSF Railway · OABNSF Railway interview questions
- Count Smaller Prior ElementsTata Consultancy Services · OATata Consultancy Services interview questions
- Horizontal Pod AutoscalerSnowflake · OASnowflake interview questions
- Horizontal Pod AutoscalerRubrik · OARubrik interview questions
- Photo AlbumFactSet · OAFactSet interview questions
- Maximum Profit from an Increasing Price TripletOdoo · OAOdoo interview questions
- Count Decreasing TripletsAirbnb · OAAirbnb interview questions
- Maximize Shipment Order by Sorting One WindowAmazon · OA
DoorDash interview experiences
- DoorDash SWE Onsite: Donation System Design: 1 Experience
- DoorDash SWE Phone Screen: Bootstrap API in Java: 1 Experience
- DoorDash SWE Virtual Onsite: 1 Experience
- DoorDash SWE Phone Screen: Bootstrap API Parsing: 1 Experience
- DoorDash Senior SWE Onsite Interview Experience: 1 Experience
- DoorDash AI CodeCraft Interview: 8 Experiences