Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Stock Price Fluctuation
Bookmark
Input
Example 1
Multiple Updates
Single Stock
Custom
operations
=
[StockPrice, update, update, current, maximum, update, minimum]
,
values
=
[null, 1,10, 2,5, null, null, 1,3, null]
Operation
—
Result
—
Latest Timestamp
—
Timestamp → Price (HashMap)
Timestamp
Price
(empty)
Price → Count (Sorted TreeMap)
(empty)
algo
master
.
io
Step:
Initialize StockPrice with empty HashMap and TreeMap
0 / 29
Input
Example 1
Multiple Updates
Single Stock
Custom
operations
=
[StockPrice, update, update, current, maximum, update, minimum]
,
values
=
[null, 1,10, 2,5, null, null, 1,3, null]
0 / 29
Operation
—
Result
—
Latest Timestamp
—
Timestamp → Price (HashMap)
Timestamp
Price
(empty)
Price → Count (Sorted TreeMap)
(empty)
algo
master
.
io
Step:
Initialize StockPrice with empty HashMap and TreeMap