0 day streak
Anonymous · shared experience20 May 2025 · 10 views

Meesho: Inventory holds that auto-release if the order isn't confirmed in time

Interview question #Meesho SDE 3 / Senior Machine coding

Problem. In 90 minutes, build an inventory service that can hold stock for an order for a limited time, for example 5 minutes. If the order is not confirmed within that window, the held units go back into available stock.

Interface.

  • blockInventory(productId, count, orderId)
  • confirmOrder(orderId)
  • getInventory(productId) returns the available count

Requirements. Working code that is modular and extensible, and that behaves correctly when several threads call it at the same time.

Candidate's direction. Store reservations in a thread-safe priority queue ordered by expiry. A background thread checks the earliest reservation and releases it once expired. They mentioned a delay queue as a cleaner option.

Advice from the candidate. Get the code running first, and don't load it with design patterns early. The interviewer asked follow-up questions, which the post does not list, and the candidate felt the round went well.

0 comments

Comments 0

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