Company: Agoda_15dec
Difficulty: medium
Final Price Final Price Problem Description A shopkeeper arranges items in a list for a sale. Starting from the left, each item is sold at its full price minus the price of the first item to its right that is of equal or lower price. If no such item exists, the current item is sold at its full price. Print the sum of the final cost for all items, then on the next line, print space-separated, 0-based indices of items that are sold at full price, in ascending order. Examples Example 1 For example, consider the item prices [2, 3, 1, 2, 4, 2] . Item at index 0, priced at 2, is discounted by 1 (item at index 2), final price is 1. Item at index 1, priced at 3, is discounted by 1 (item at index 2), final price is 2. Item at index 2, priced at 1, sells at full price as there are no equal or lower-priced items to its right. Item at index 3, priced at 2, is discounted by 2 (item at index 5), final price is 0. Item at index 4, priced at 4, is discounted by 2 (item at index 5), final price is 2. T