Peak Commodity Price Lookup with Timestamp Indexing

Design a data store class that tracks commodity prices over time. It should support two operations: (1) add(timestamp, price) — records a new price for a given Unix timestamp, allowing multiple prices per timestamp; (2) highestPrice(timestamp) — returns the maximum price recorded at or before the given timestamp (not just exactly at it). The key challenge is efficiently querying the highest price across a time window. Handle duplicate timestamps, unordered insertions, and edge cases where no prior timestamp exists.

Examples
Input: []
Output:
Hints

Peak Commodity Price Lookup with Timestamp Indexing

Design a data store class that tracks commodity prices over time. It should support two operations: (1) add(timestamp, price) — records a new price for a given Unix timestamp, allowing multiple prices per timestamp; (2) highestPrice(timestamp) — returns the maximum price recorded at or before the given timestamp (not just exactly at it). The key challenge is efficiently querying the highest price across a time window. Handle duplicate timestamps, unordered insertions, and edge cases where no prior timestamp exists.