Skip to main content

Command Palette

Search for a command to run...

A Comprehensive Guide to Solving Problems in Technical Interviews Like a Pro

Mastering the Art of Problem Solving in Coding Interviews: A Comprehensive Guide

Updated
3 min read
A Comprehensive Guide to Solving Problems in Technical Interviews Like a Pro
J

Full Stack Engineer (TypeScript, React.js, Node.js) and Stripe Implementation Architect with 6+ years of experience, leveraging AI-native workflows (Cursor, Claude Code) to deliver scalable solutions to improve user interactions and business processes. Proven track record of mentoring 200+ developers across 3 continents and implementing enterprise payment solutions. Specialist in clean architecture and modern stacks.

Solving coding problems is essential for any engineer, whether you're applying for a new job or just trying to improve your skills. But how do you approach a coding problem? Here's a step-by-step guide to help you solve any coding problem:

P - PROBLEM

The first step is not to jump into code but to read and understand the problem. Begin by summarising the key points of the problem. Make sure you have a clear understanding of what the problem is asking you to do.

Q - QUESTIONS

Next, ask questions. Ask clarifying questions to ensure you have a complete understanding of the problem. For a function, verify input and output types and constraints. Here are some example questions:

  • Is the dataset sorted?

  • Are there repeating elements in the dataset?

  • What are the possible input values for the function parameters?

  • Does the data have negative values?

Once you understand the inputs and outputs, you can think better about solutions.

BFS - BRUTE FORCE SOLUTION

Don't be afraid or ashamed to offer up the first solution that comes to mind. The majority of the time, this solution is not ideal and will require some fine-tuning.

O - OPTIMIZE SOLUTION

Once you have a BFS, with your understanding of Data Structure and Algorithms, explain why your BFS is not an optimum solution. This helps you to understand the problem better and to come up with better solutions. Next, think out loud as you make your way to your better solution, verifying with your interviewer what is most important: memory or time.

Some helpful tips to improve your BFS:

  • Use hash maps or tables to improve time complexity at the cost of space complexity.

  • Try sorting the values in the dataset. It might make the dataset easier to work with.

  • A binary tree is best for sorted arrays.

For a better understanding of space and time complexity, check out this post

Write pseudocode step by step with comments where needed, making up function names where you can't remember a language-specific function/method. Once you have an optimised solution, test it with examples, at least one passing and one failing case.

C - CODE

Now, you can write your code. Write code with readable variable names, focusing on the part of the algorithm that will make you stand out from the competition. Do not be scared to ask if you can use your favourite programming language.

T - TEST

After writing, it is time to test it. Test your code with various inputs, safeguarding your solution from false inputs and edge cases. Check for no parameters, 0, undefined, null, empty string, empty array, massive array, repetitions, nested loops, recursion, etc.

R - REVIEW

Once you're done and ready to submit your solution, review your submission with your interviewer, asking for feedback on readability and improvement. Here's a tricky one: ask the interviewer about the most intriguing solution they have seen to this problem.

Remember to communicate your thought process as much as possible, and don't be in a hurry. Follow the interviewer's advice, tips, and hints when given.

If you have a follow-up question about how to handle input too large for memory or an input that is a stream. The answer is to use a divide-and-conquer approach, where the input is divided into chunks, and each is processed and then combined to give the results.

Solving coding problems takes practice, but with the right approach, you can improve your skills and become a better programmer. Watch this [Google Interview video](https://www.youtube.com/watch?v=XKu_SEDAykw) for more tips and advice on how to solve coding problems.

A
Austin3y ago

Great tips! One more I've learned is solving the problem in english and understanding each individual step

e.g. "I want to iterate through this array, and check that thing over there. If it's less than X, I want to count it toward a total"

Especially for beginners, solving a problem first in their natural language makes it much easier to consider how to program an algorithm to do it

2
J

Truth. Makes a lot of sense. Coding should be the last step

2