Advancedcoding Verified
A stream of stock prices arrives as (timestamp, price), and an earlier timestamp can later be corrected. Support update, current price, maximum and minimum efficiently.
ReportedSource: GeeksforGeeks interview experience: Google SDE 2024
Quick answerFree
Hash map timestamp -> latest price, track max timestamp for current, and max/min heaps with lazy deletion (pop entries whose price no longer matches the map). Or a sorted multiset of prices.
Detailed answer· ~140 words
Interview PrepUnlock the full answer with Interview Prep
Get a ~140-word model answer and a runnable reference solution, plus 61 more DSA questions.
Also in Pro (₹499 / 90 days).
Reference solution· runs in the browser sandbox
Interview PrepUnlock with Interview Prep
+ 61 more DSA questions in Interview Prep, each with the full answer.