Machine codingCommerce operationsIdempotency

Amazon India-Style Machine Coding Round: Format, Tips & Practice Problems

Written and reviewed by Sahil Srivastav

Commerce systems expose correctness problems in a compact form: stock must not oversell, an order must follow a legal lifecycle, and a retry must not create a second refund. Rounds in the style of Amazon India use these mechanics to see whether working code remains safe when the happy path is interrupted.

The company label describes a style, not a source of questions. The material here is a Gronex practice guide for a time-boxed implementation followed by edge-case discussion.

What a Amazon India-style machine coding round looks like

A typical exercise is a 60–120 minute build around inventory reservation, returns, order fulfilment, or a job worker. You receive concrete rules and are expected to produce a runnable core with tests or a small demonstration.

Follow-ups tend to introduce duplicate delivery, partial refund, or concurrent buyers. The safest approach is to name the invariant first, then make the state transition and idempotency key visible in code.

A reviewer usually values a complete core over infrastructure. Once the flow works, explain where a database constraint, queue, or retry policy would enforce the same invariant in production.

How you’re evaluated

Runnable core

The main commerce flow can be exercised end to end in the allotted time.

Invariant-first design

Stock, money, and lifecycle rules remain true through retries and partial failure.

Operational boundaries

Jobs and callbacks are idempotent, with a clear recovery path for unknown outcomes.

Readable change surface

A new fulfilment or refund rule can be added without destabilising existing paths.

Common mistakes that fail this round

  • Starting with a large API or database layer before the domain works.
  • Treating retry as a new request rather than the same business operation.
  • Allowing a cancelled order to retain stock or a refund to exceed capture.
  • Hiding state transitions in unrelated handlers.
  • Leaving boundary conditions for quantity and money implicit.

Quick tips for the room

  • Make the end-to-end demo run early.
  • Generate idempotency keys before side effects.
  • Keep money in integer minor units.
  • Say what happens when the downstream result is unknown.

How to prepare

Time a complete inventory or returns build and reserve the last minutes for duplicate and cancellation cases.

Use the repositories below to rehearse reading tests as a specification and stating the invariant your fix preserves.

Practice problems in the Amazon India-style round format

Each is a real backend repository with a failing test suite — the same working-code standard the round applies. Open the brief and read the full problem, no signup required.

HARD~120 min

Flash Sale Inventory Purchase System

Reserve exactly available stock while buyers race the same SKU.

Open the challenge →
MEDIUM~75 min

Warranty RMA Return Authorization

Validate returns and apply refund plus restock atomically.

Open the challenge →
HARD~90 min

Distributed Job Scheduler

Prevent duplicate background execution when workers overlap.

Open the challenge →
MEDIUM~90 min

E-Commerce Coupon Engine

Eligibility, stacking, and idempotent redemption rules.

Open the challenge →
HARDFree~90 min

Duplicate Side Effects After Restart

Make an at-least-once consumer produce one business effect. Free to try.

Open the challenge →

Rehearse the round before you sit it

Open a real repository, see the failing tests, and make them pass against the clock — the loop a Amazon India-style machine coding round actually grades. Start free, no card required.

FAQ

Were these actual Amazon India questions?

No. They are Gronex originals in the style of commerce and operations rounds. Gronex is not affiliated with Amazon.

Do I need a distributed system in the room?

Build the smallest correct core. Explain how a queue, constraint, or worker lease would carry the invariant at production scale.

What should I prioritise?

A running happy path, explicit state transitions, and two failure cases beat an unfinished architecture.

Which language should I use?

Use the language in which you can make the model and tests clear under the time limit.

Related

Gronex is not affiliated with, endorsed by, or sponsored by Amazon India. All company names and trademarks belong to their respective owners. The problems on this page are Gronex originals written in the style of such interview rounds — not actual interview questions from Amazon India.