Array of item prices: [5, 1, 3, 4, 6, 2]
Discount on each item is the first price to the right, lesser than or equal to its own price. If no such price found, no discount applicable. Print total price and indexes (0-index based) of items with full price to be paid.
Eg. for above example, item discounts will be: [1, 0, 2, 2, 2, 0]
So, final prices will be: [4, 1, 1, 2, 4, 2]
So, answer will be:
14 (total price)
1 5 (1 and 2 have full prices to be paid)