Algorithm · Palantir · Medium
Given a shopping cart and a set of percentage coupons, compute three integer-cent totals: the original subtotal, the sum of all per-row rounded discounts, and the final amount after subtracting that discount sum. Implement apply_discounts_and_calculate_total(items, discounts). The items argument is a list of item records, shown as [name, price] pairs; the same name may appear on several rows. The discounts argument is a list of coupon records, shown as [name, percent_off]…
Checking your access…