PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates algorithmic reasoning for scheduling and capacity planning (minimum daily shipping capacity) and combinatorial optimization with constrained purchases (bundle-cost minimization).

  • medium
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Solve Shipping and Bundle-Cost Problems

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Implement both of the following algorithmic problems. Problem 1: Minimum daily shipping capacity You are given an array `weights` of positive integers. Packages must be shipped in the given order. Each day, you load packages from left to right until adding the next package would exceed the ship's capacity. The remaining packages are shipped on later days. Given an integer `days`, return the minimum ship capacity needed to deliver all packages within `days` days. Problem 2: Minimum cost with bundle offers You need to buy `n` kinds of items. Array `price[i]` gives the individual price of item `i`. Each special offer is an array of length `n + 1`: the first `n` values are quantities of each item in the bundle, and the last value is the bundle price. Given `price`, `special`, and `needs`, return the minimum total cost to satisfy `needs` exactly. You may buy any offer multiple times, but you may not purchase more of any item than needed.

Quick Answer: This question evaluates algorithmic reasoning for scheduling and capacity planning (minimum daily shipping capacity) and combinatorial optimization with constrained purchases (bundle-cost minimization).

Minimum Daily Shipping Capacity

Return the minimum capacity needed to ship ordered packages within the given number of days.

Constraints

  • weights are positive

Examples

Input: ([1, 2, 3, 1, 1], 4)

Expected Output: 3

Explanation: Capacity 3 ships in four days.

Input: ([3, 2, 2, 4, 1, 4], 3)

Expected Output: 6

Explanation: Capacity 6.

Input: ([10], 1)

Expected Output: 10

Explanation: Single package.

Hints

  1. Binary-search capacity with a greedy day counter.

Minimum Cost with Bundle Offers

Return the minimum exact cost to satisfy item needs using unit prices and reusable bundle offers.

Constraints

  • Oversupply is not allowed

Examples

Input: ([2, 5], [[3, 0, 5], [1, 2, 10]], [3, 2])

Expected Output: 14

Explanation: Classic shopping offers.

Input: ([2, 3, 4], [[1, 1, 0, 4], [2, 2, 1, 9]], [1, 2, 1])

Expected Output: 11

Explanation: Use a mix of offers and units.

Input: ([5], [], [3])

Expected Output: 15

Explanation: No offers.

Hints

  1. Memoize by remaining needs; unit purchases are the fallback.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ 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 Path Length Through a Grid With One Allowed Cell Conversion - Amazon (medium)
  • Circular Drone Hub Delivery Route - Amazon (hard)
  • Leaf Domain Cumulative Scores - Amazon (medium)
  • Kth Largest Perfect Binary Subtree - Amazon (medium)
  • Find Conflicting Events - Amazon (medium)