0 day streak
Anonymous · shared experience20 Sept 2026 · 8 views

Instacart: Cheapest cart total given percent-off and buy-x-get-y-free discounts

Interview question #Instacart DSA / coding

Problem. You are given a transaction (the items being bought) and a set of available discounts. Discounts come in two kinds: a percentage off, and buy-x-get-y-free deals. Return the lowest price the customer can pay.

Structure. The question was built in three parts that get progressively harder. The candidate finished only the second part before time ran out and never saw the third, so speed through the early parts matters.

Context. First of two coding rounds in a four-round onsite (two coding, a behavioral chat with a manager, and an inventory-focused system design). The candidate described the coding overall as not too hard but was rejected.

What to prepare. The post gave no examples or limits. Settle early whether discounts can stack, whether each item can take only one discount, and how buy-x-get-y applies across quantities. Write the price calculation so a new discount type can slot in without rewriting everything, since later parts likely add rules.

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.