Final Prices With a Special Discount in a Shop
For each item, find the discount from the first later price that is no greater than it. The visual uses a stack to match each price with its discount.
For each item, find the discount from the first later price that is no greater than it. The visual uses a stack to match each price with its discount.