Maximize Inventory

ASKED IN INTERVIEW
10pts
Amazon

Problem Statement

Calculate the maximum number of prime and standard items that can fit into a 500,000 square foot warehouse. You must prioritize prime items first.

Rules:

  • Warehouse Size: 500,000 sqft.
  • Calculate total batches of prime items that fit first.
  • Use remaining square footage for standard items.
  • Output: item_type (priority level), item_count.
  • Sort by item_count DESC.
Tests your understanding of
Common Table Expressions, Mathematical Modeling and Window Functions

Input Tables

warehouse_inventory
item_id(INTEGER)item_type(VARCHAR)item_count_per_batch(INTEGER)batch_square_footage(DECIMAL)
1prime_delivery200150.5
2standard_delivery500300
item_categories
item_type(VARCHAR)priority(VARCHAR)
prime_deliveryhigh
standard_deliverylow
warehouse_specs
warehouse_id(INTEGER)total_sqft(INTEGER)
1500000

Expected Output

item_type(VARCHAR)item_count(INTEGER)
prime_delivery664400
standard_delivery0

Tags

HardASKED IN INTERVIEWCommon Table ExpressionsMathematical ModelingWindow Functions
45-55 min
24%

Hints