Common Problems
Inventory Management
Try This Problem Yourself
Practice with guided hints and real-time feedback
Understanding the Problem
Requirements
"Design an inventory management system that tracks products across multiple warehouses. The system needs to handle adding and removing inventory, transferring stock between locations, and alerting when inventory runs low."
Clarifying Questions
You: "When you say 'multiple warehouses,' are we talking about a fixed set of warehouses configured at startup, or can warehouses be added dynamically?"Interviewer: "Keep it simple. Fixed set of warehouses. You can assume they're configured when the system initializes."
You: "For the low-stock alerts you mentioned, how do those work? Do we configure a threshold per product, or is it more granular?"Interviewer: "It should be per product per warehouse. Different warehouses might need different thresholds for the same product. When stock drops below the threshold, trigger a notification."
You: "How should the notification happen? Are we sending emails, calling a webhook, or just returning something to the caller?"Interviewer: "Good question. Let's keep it pluggable. The system should call some callback interface when stock is low. What happens after that - email, webhook, logging - is someone else's problem."
You: "What about invalid operations? Should we allow negative inventory, or reject operations that would take stock below zero?"Interviewer: "Reject them. If someone tries to remove 100 units but we only have 50, that should fail. Same with transfers, validate before moving anything."
You: "What about concurrent access? If two processes are trying to modify the same warehouse's inventory at the same time, do we need to handle that?"Interviewer: "Yes, concurrency is important here. Multiple operations could be happening simultaneously - one warehouse receiving a shipment while another is fulfilling an order for the same product. Make sure operations are thread-safe."
You: "Last one. What's out of scope? Are we managing product catalogs, handling orders, that kind of thing?"Interviewer: "Yes. Products exist externally. Orders and payments are handled upstream. Keep the focus on the inventory tracking logic."
Final Requirements
Requirements:
1. Track inventory for products across multiple warehouses
2. Add stock to a specific warehouse (receiving shipments)
3. Remove stock from a specific warehouse (fulfilling orders)
4. Check availability: given a product and quantity, return which warehouses can fulfill it
5. Transfer stock between warehouses
6. Low-stock alerts
7. Reject operations that would result in negative inventory
8. System must be thread-safe to handle concurrent operations
Out of Scope:
- Product catalog management (products exist externally)
- Order processing / payment / serviceability
- PersistenceCore Entities and Relationships
Class Design
InventoryManager
Warehouse
AlertConfig
AlertListener
Final Class Design
Implementation
InventoryManager
Warehouse
AlertConfig
AlertListener
Complete Code Implementation
Verification
Test Case 1: Alert threshold crossing behavior
Test Case 2: Atomic transfer with proper locking
Test Case 3: Validation prevents negative inventory
Extensibility
"How do you prevent overselling when orders are in progress?"
"How would you handle inventory that's being shipped between warehouses?"
What is Expected at Each Level?
Junior
Mid-level
Senior
Purchase Premium to Keep Reading
Unlock this article and so much more with Hello Interview Premium
Currently up to 20% off
Hello Interview Premium
On This Page
Understanding the Problem
Requirements
Clarifying Questions
Final Requirements
Core Entities and Relationships
Class Design
InventoryManager
Warehouse
AlertConfig
AlertListener
Final Class Design
Implementation
InventoryManager
Warehouse
AlertConfig
AlertListener
Complete Code Implementation
Verification
Extensibility
"How do you prevent overselling when orders are in progress?"
"How would you handle inventory that's being shipped between warehouses?"
What is Expected at Each Level?
Junior
Mid-level
Senior
Prepping for interviews? Get the path to your next role
Everything you need to start preparing, totally free.
Personalized learning checklist
Free guided practice sessions
Track your progress across topics
AI tutor to answer your questions