Shop Checkout Total with Next Cheaper-or-Equal Markdown
Asked at Uber · Coding Questions · Difficulty: Easy · Last asked Apr 1, 2026
A shop sells items laid out in a row, and runs a markdown promotion: each item is discounted by the price of the first item after it that costs the same or less. An item with no such later item is sold at full price. Compute what the shop collects in total and which items are sold at full price.
Loading the problem…