Your question is Stock Price Fluctuation Coding. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Model stock price updates for a Jira Marketplace analytics feed. Each update associates a timestamp with a price, and a later update at the same timestamp replaces the previous value.
Implement stock_price_fluctuation(operations), which processes operations in order and returns the results of all query operations. Use a hash map to store the latest price for each timestamp and priority queues to retrieve minimum and maximum prices efficiently. Because Python heaps do not support arbitrary deletion, remove outdated heap entries lazily when they reach the top.
operations, a list of operation lists. Each operation is one of:
['update', timestamp, price]['current']['maximum']['minimum']timestamp and price are integers.def stock_price_fluctuation(operations):