PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates dynamic programming and combinatorial optimization skills, focusing on state definition, transitions, memoization, pruning dominated offers, and minimizing state space for menu-combo minimum-cost problems in the domain of Coding & Algorithms.

  • medium
  • Airbnb
  • Coding & Algorithms
  • Software Engineer

Solve and optimize menu combo DP

Company: Airbnb

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Given up to N different menu items, each with a unit price, and a list of combo offers where each offer specifies quantities for some items and a total combo price, write an algorithm that, given the required quantities for each item, returns the minimum cost to satisfy the order without buying extra items. Describe and implement a dynamic programming or memoized search solution, stating the state definition, transitions, and base cases. Analyze time and space complexity in terms of N (item types), Q (maximum needed quantity per item), and S (number of offers). Follow-up: When N = 3, propose and implement an optimization that leverages a fixed 3D state (i, j, k) to reduce overhead; explain any preprocessing such as pruning dominated or irrelevant offers and capping offer counts to needs; provide the resulting complexity. Discuss additional practical optimizations such as skipping offers that exceed current needs or reordering states to enable bottom-up computation.

Quick Answer: This question evaluates dynamic programming and combinatorial optimization skills, focusing on state definition, transitions, memoization, pruning dominated offers, and minimizing state space for menu-combo minimum-cost problems in the domain of Coding & Algorithms.

You are given N item types with unit prices, a list of S combo offers, and the required quantities (needs) for each item. Each offer is a list of length N+1 where the first N entries are quantities for each item and the last entry is the total offer price. Compute the minimum total cost to satisfy the needs exactly (no extra items allowed). You may use an offer multiple times as long as it never causes any item's purchased quantity to exceed its remaining need.

Constraints

  • 1 <= N <= 6
  • 0 <= S <= 100
  • 0 <= needs[i] <= 10
  • 1 <= prices[i] <= 10^4
  • Each offer is length N+1: first N non-negative integers are quantities, last is offer price (0 <= offer price <= 10^5)
  • No extra items allowed: an offer can be applied only if all its quantities are <= the remaining needs
  • All inputs are integers

Hints

  1. Model the state as the remaining needs vector; use memoization with the state as a tuple.
  2. Baseline for any state: buy remaining items individually; try applying each valid offer to reduce the state.
  3. Prune offers whose price is >= the cost of buying their quantities individually, and offers that have any quantity exceeding needs.
  4. For N=3, build a bottom-up 3D DP of size (needs[0]+1)*(needs[1]+1)*(needs[2]+1), initializing with individual-buy costs and relaxing with offers.
  5. Skip offers that exceed current remaining needs to enforce the no-extras rule.
Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Minimum Canisters to Top Up an Exact Target - Airbnb (medium)
  • Count Candies from Unlockable Boxes - Airbnb (medium)
  • Find Optimal Property Combination - Airbnb (medium)
  • Determine Exact Layover Booking - Airbnb (medium)
  • Solve Linked-List and Iterator Problems - Airbnb (medium)