Object-Oriented Programming · Oracle · Medium
Problem A retailer wishes to monitor the price history of a single product over time. Design a data structure that can record price updates at arbitrary timestamps and at any moment return the latest, the minimum, and the maximum price seen so far. Implement the ProductPrice class: ProductPrice() Initializes an empty tracker. void update(int timestamp, int price) Logs the given price at the moment identified by timestamp. If this timestamp has already been recorded, its…
Checking your access…