Leetcode 1357 Apply discount every n orders

In this Leetcode problem, we are asked to return the cost of different orders, knowing that we apply a discount every n customers. Here is the problem statement:

There is a sale in a supermarket, there will be a discount every n customer.
There are some products in the supermarket where the id of the i-th product is products[i] and the price per unit of this product is prices[i].
The system will count the number of customers and when the n-th customer arrive he/she will have a discount on the bill. (i.e if the cost is x the new cost is x - (discount * x)