Shopping Cart Billing π»
An e-commerce company is currently celebrating ten years in business. They are having a sale to honor their privileged members, those who have been using their services for the past five years. They receive the best discounts indicated by any discount tags attached to the product. Determine the minimum cost to purchase all products listed. As each potential price is calculated, truncate it to its integer part before adding it to the total. Return the cost to purchase all items as an integer.
There are three types of discount tags:
Complete the function findLowestPrice in the editor below.
findLowestPrice has the following parameter(s):
String[][] products: a 2D array of product descriptors as strings: price followed by up to m-1 discount tagsString[][] discounts: a 2D array of tag descriptors as strings: tag, type, amount
Returns
int: the total amount paid for all listed products, discounted to privileged members' pricing
1Example 1
Constraints
Limits and guarantees your solution can rely on.
- 1 β€ n, m, d β€ 1000
- tags are not unique