Shopkeeper Sale

A shopkeeper has a sale to complete and has arranged the items being sold in a list.

Starting from the left, the shop keeper rings up each item at its full price less the price of the first lower or equally priced item to its right.


This is a companion discussion topic for the original entry at https://algo.monster/problems/shopkeeper_sale/