Computer Science, asked by jashmika, 21 days ago

Final Discount Price
A shopkeeper has a sale to complete and has arranged the items being sold in an array. Starting from the left the shopkeeper sells each item at its fun
price minus the price of the first lower or equal priced item to its right. If there is no item to the right that costs less than or equal to the current items
price, the current item is sold at full price.
For example, assume there are items priced (2,3,1,2,4,2)
• The items 0 and 1 are each discounted by 1 unit, the first equal or lower price to the right
• Item 2, priced 1 unit sells at full price because there are no equal or lower priced items to the right
• The next item, item 3 at 2 units, is discounted 2 units, as would the item 4 at 4 units
• The final item 5 at 2 units must be purchased at full price because there are no lower prices to the right
The total cost is 1+2+1+0+2+2=8 units. The full price items are at indices (2,5) using Obased indexing.
You have to print the sum of the final prices.​

Answers

Answered by manpreetpandher03
0

Answer:

I don't know

Explanation:

I don't know

Similar questions