The Machine Coding Round
Prepare for the 90-120 minute machine coding round at Flipkart, Swiggy, Razorpay and similar companies: working, extensible code under time pressure.
Intermediate · about 10 hours · difficulty 3/5
Learn first: LLD Case Study: Parking Lot
Many Indian product companies run a machine coding round: you get a problem statement (a cab booking service, a snake and ladder game, an in-memory key-value store, a meeting room scheduler) and 90 to 120 minutes to write working, runnable code that you then demo and explain.
What evaluators look for
- It runs and handles the given test inputs. A beautiful design that does not run usually fails.
- Modularity and extensibility: separate models, services and the driver; adding a feature should not require a rewrite.
- Clean code: meaningful names, small methods, no copy-paste, sensible exceptions.
- Correctness on edge cases: invalid input, empty states, duplicates.
- Often bonus requirements (concurrency, a new feature) that reward a flexible design.
A time plan for 90 minutes
- 10 minutes: read carefully, list requirements, ask clarifying questions, sketch entities.
- 50 minutes: code models, then services with interfaces, then a simple driver (main method or CLI). Keep it running at every step.
- 15 minutes: edge cases, input validation, bonus features.
- 10 minutes: tidy up, run through the sample inputs, prepare to explain.
Practical habits
- Use in-memory storage behind a repository interface; do not set up a real database.
- Use the language you are fastest in; Java, Python, Go, C++ and TypeScript are all common.
- Prepare a mental skeleton: models, repositories, services, strategies, exceptions, driver.
- Practise with a timer on 10 to 15 classic problems: parking lot, Splitwise, snake and ladder, elevator, cab booking, in-memory cache with TTL and LRU, rate limiter, logger, library management, food ordering.
Pitfalls
- Over-engineering early and not finishing.
- Everything in one file and one class.
- Not reading the input/output format and losing marks on demo.
You are ready to move on when you can finish two unseen machine coding problems in 90 minutes each with code that runs, passes the sample inputs and handles one new requirement with small changes.
Key concepts
- Reading and scoping the problem
- Working code first
- Models, services, repositories layout
- In-memory storage behind interfaces
- Time management
- Handling bonus requirements
- Snake and ladder, elevator, cab booking practice
Mini project
Do four timed 90-minute machine coding sessions (snake and ladder, in-memory LRU cache with TTL, meeting room scheduler, cab booking) and push each to GitHub with a README, sample input and output, and a note on what you would improve.
Check yourself
With 20 minutes left and a bonus requirement unfinished, what do you prioritise, and why?
Free resources
- Awesome Low Level Design (GitHub)
- Flipkart Tech Blog (Flipkart)
- Refactoring.Guru (Refactoring.Guru)