Leetcode 1475: Final Prices With a Special Discount in a Shop

In this Leetcode problem, we want to find the real prices of items given a special discount rule.

Problem statement

Solution

A couple of ideas for the solution:

  1. Create a new array res to hold the result of the method (we could very well use the input array too, and there is no problem doing that)