Back to problems

Stack Item and Category Coupons with an Eighty-Percent Cap

Algorithm · Palantir · Hard

You are given two arrays: items and discounts. Each entry in items contains a string name, a string category, and a nonnegative integer price measured in cents. Each entry in discounts contains a type of either "item" or "category", a string name, and an integer percent_off. For an "item" coupon, name is compared with the item's name; for a "category" coupon, name is compared with the item's category. A coupon object may omit type; treat such legacy coupons as "item"…

Checking your access…