Disclaimer: This article was written few years ago and may no longer be relevant as software engineering has changed a lot in the last few years. This is what may be more relevant now: Future of Software Engineering - Gaurav Chandak
Machine Coding Round Complete Guide
Machine coding round involves solving a design problem in a matter of a couple of hours. It requires designing and coding a clean, modular, and extensible solution based on a specific set of requirements.
An example of a machine coding problem could be to design a snake and ladder game with certain requirements and constraints. This is generally followed by a code review process where an interviewer goes through the code and tries to understand the design decisions.
Flipkart, Uber, Swiggy, Ola, Cred, etc. are some of the top tech companies where the first onsite round is the machine coding round.
This article will tell you what are the things that you need to take care of during the machine coding round. If you've never solved a machine coding question, you must check out:
Let's look at how to ace the machine coding round. We've divided
After getting the question (5-10 mins)
- Read the problem statement carefully. Try to clearly understand all the requirements.
- Do not assume anything that is not mentioned in the problem statement. If you want to make a specific assumption, discuss it with the interviewer at this stage.
- Ask as many clarifying questions as you can think of so as to make the requirements clear and remove any room for ambiguity or misinterpretation.
Getting to the solution (10-15 mins)
- Spend ~10 minutes thinking about the design of your solution. This is important. You do not want to start coding before a proper design.
- While designing think about how you can make it extensible to accommodate the optional requirements or any common extension that you can think of. Following good design principles and patterns will generally help.
- Estimate how much time will it take you to code with all the requirements. Prioritize which ones to do so as to at least solve the most critical ones.
- Apart from the design, estimate some time for creating the main method or API/CLI interface as mentioned in the problem statement or as clarified with the interviewer.
- Also, estimate some time for testing and making changes to have the solution working.
- If your current solution will take a lot of time to code, try to think of a simpler design that is good enough and will take less time to code. This is one of the biggest trade-offs in a machine coding round (and in general, software development).
- Do not prioritize an optional requirement over a mandatory requirement. If you focus more on extensibility and future requirements and are unable to complete a mandatory requirement, it's a red flag.
- Optional: If possible, draw a UML diagram of your design for clarity.
Coding (60-75 mins)
- If you've designed the solution and are comfortable in coding, this step should be fairly easy. Just make sure to code fast so as to complete as many requirements as possible.
- In the end, you need to have a working code. Be ready with good sample examples to demonstrate your solution.
- Gracefully handle exceptions and other corner cases. You do not want your code to fail during the demonstration.
- Write readable code with proper names. Use comments, if possible. You are writing the code for your interviewer to read and understand.
- Use a powerful IDE that you are comfortable with. Choose one where you can generate most of the boilerplate code to save time.
Demonstration
- While demonstrating, make sure to give a high-level overview of your solution. Do not explain each and every line of the code. Your code should be modular and self-explanatory.
- Tell the interviewer about all the requirements that you've completed and if your solution is extensible for other requirements.
- After running your solution on sample input, it may be a good idea to ask the interviewer if they want you to test with any other input.
---
Join our discord community to have healthy discussions on programming, interviews and job search.



