Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Final Prices With a Special Discount in a Shop
Bookmark
Input
Input 1
Input 2
Input 3
Custom
prices
=
[8, 4, 6, 2, 3]
prices
8
4
6
2
3
0
1
2
3
4
stack
(empty)
result
monotonic stack: an item is discounted by the next price ≤ it
algo
master
.
io
Step:
Start of algorithm
0 / 18
Input
Input 1
Input 2
Input 3
Custom
prices
=
[8, 4, 6, 2, 3]
0 / 18
prices
8
4
6
2
3
0
1
2
3
4
stack
(empty)
result
monotonic stack: an item is discounted by the next price ≤ it
algo
master
.
io
Step:
Start of algorithm