You’ve applied to your dream job. You’ve passed the phone screen and screening test. Now the only thing standing in your way is the coding interview.
Are you prepared?
Even the most experienced developers can find traditional technical interviews daunting. But many emerging technical interview approaches provide an opportunity to demonstrate your skills in a real-world setting. From coding to algorithms to problem solving, technical interviews done well should test the top skills in your arsenal.
The Technical Interview: An Overview
Technical interviews are the process of evaluating developers through questions that place an emphasis on technical skills. Hiring teams use individual assignments such as coding questions, projects, or data structure problems to test and score a developer’s proficiency in key skills.
These interviews gauge a developer’s problem-solving skills and technical proficiency in various programming languages and frameworks. And they also give a glimpse into soft skills — like collaboration or communication style.
Types of Interview Questions — and How to Prepare for Them
Technical interviews come in many styles and formats. Each type of interview will test different skill sets and require a different approach to succeed. Preparing for a system design question, for example, looks a lot different than preparing for a coding challenge.
Before we dive in, it’s worth noting that there is some overlap between various types of interview questions. Technical interviews often test many skills at the same time, including algorithms, clean code practices, and language proficiency, to name a few examples, and those skills can often be showcased across a number of formats.
Coding questions — sometimes called coding challenges — ask developers to write code to find an answer to a problem. Depending on the role and company, coding questions can be language-specific or allow developers to respond in their coding language of choice. Often, these questions are asked directly via an in-browser IDE that provides developers with the tools they need to provide a solution in full.
While coding questions come in a variety of formats, the strategies for answering them are similar. As you write your code, you’ll be expected to explain your solution to the hiring team. They’ll typically give you real-time feedback on the efficacy, complexity, and accuracy of your solution.
It’s important to keep in mind that a “correct” answer isn’t always enough to pass a coding interview. That’s because the approach also allows hiring teams to assess your technical communication, your code quality, and the efficiency of the solution.
- Write a function int max_of_four(int a, int b, int c, int d) which reads four arguments and returns the greatest of them. There is not a built-in max function in C. Code that will be reused is often put in a separate function, e.g. int max(x, y) that returns the greater of the two values. Input will contain four integers – a, b, c, d – one on each line. Note: I/O will be automatically handled. (Language: C)
- A hacker practices on HackerRank until getting to a rating of O(1) read as (Oh-one). Call the method coder.practice until coder.oh_one? becomes true. Use the until control structure. until is the logical equivalent of while not. This challenge has a one-line answer. (Language: Ruby)
- Given an integer, n, perform the following conditional actions (Language: Java):
- If n is odd, print Weird
- If n is even and in the inclusive range of 2 to 5, print Not Weird
- If n is even and in the inclusive range of 6 to 20, print Weird
- If n is even and greater than 20, print Not Weird
- Input format: a single line containing a positive integer n. Constraints: 1 <= n <= 100.
Problem-solving interview questions test a candidate’s ability to, well, solve problems. Many developers associate problem-solving interviews with technical questions such as algorithms and data structures. And while those challenges do test problem-solving skills, a problem-solving interview question can also be non-technical.
Problem-solving interviews aren’t just about getting the right answers. Equally (or even more) important is identifying a problem-solving approach and explaining it to the interviewer. This is especially true for non-technical problems which often have no right answer. Using an answering method can help with structuring your responses and explanations.
Lastly, it’s a good idea to treat every technical interview as an opportunity to showcase your problem-solving skills. Nearly every other question format tests for problem-solving skills, even if the interviewer doesn’t directly say so. Having a strong foundation in problem solving will support your performance in other interviewing moments.
- Given the problem of selecting a new tool to invest in, where and how would you begin this task?
- Have you ever recognized a potential problem and addressed it before it occurred?
- Tell me about a time you used a unique problem-solving approach.
Algorithm questions are a type of interview question that, in theory, test a candidate’s coding skills and ability to solve problems with algorithms. However, today’s common technical interview is far from perfect, and a lot of algorithm challenges are too theoretical in nature to fairly assess a developer’s skills. While they are beginning to fall out of favor, some companies still ask academically advanced algorithmic questions, so it’s important to know what to expect.
You should prepare for an algorithm-style interview question by studying fundamental concepts and practicing the types of questions you might face. Some developers feel that many such interview questions can only be solved by having memorized the solution beforehand. Developers who take this approach might spend hours memorizing concepts such as greedy algorithms or Dijkstra. While this doesn’t make for the best overall experience, some developers in line for their dream apply brute force memorization to ace the interview.
Even still, developing a solid understanding of algorithmic concepts will make it easier to develop a sound answering strategy when and if you’re asked a question of this type.
- Given an array of integers, find the sum of its elements. For example, if ar = [1, 2, 3], 1 + 2 + 3 = 6. So, return 6.
- Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix ar = [1, 2, 3, 4, 5, 6 , 7, 8, 9], arranged in a 3×3 grid resembling a phone keypad.
- Given a time in 12-hour AM/PM format, convert it to 24-hour military time. 12:00:00AM on a 12-hour clock is 00:00:00 on a 24-hour clock. 12:00:00PM on a 12-hour clock is 12:00:00 on a 24-hour clock. For example, if s = 12:01:00AM, return 00:01:00.
Like algorithm questions, data structure problems are a type of interview question that have begun to fall out of favor in recent years. While data structures are a fundamental computer science concept, they’ve become associated with a needlessly complex approach to technical interviews. But some companies still ask developers to solve data structure challenges in interviews, so it’s worth being prepared.
There are many different types of data structures, including arrays, stacks, queues, linked lists, and trees, to name just a few. Each structure has its own set of properties that you’ll need to master to answer a data structure interview question.
- Delete the node at a given position in a linked list and return a reference to the head node. The head is at position 0.
- You are given the pointer to the head node of a linked list and an integer to add to the list. Create a new node with the given integer. Insert this node at the tail of the linked list and return the head node of the linked list formed after inserting this new node. The given head pointer may be null, meaning that the initial list is empty.
- Given a pointer to the head node of a linked list, print each node’s element, one per line. If the head pointer is null (indicating the list is empty), there is nothing to print.
System design interviews challenge candidates to design a back-end system using a whiteboard or virtual diagramming tool. Candidates are asked to explain their solution and thought process as they develop their answer. To succeed in system design interviews, candidates need to both design a viable solution and explain how the components fit together.
System design questions don’t have one right answer. Instead, they give the developer the opportunity to work toward a variety of potential solutions. Hiring teams will often have interviewing guidelines to structure the conversation as well as a suggested solution.
The key to success is to focus on the big picture and not get bogged down in the details. After all — you need to plan a back-end system, not build one.
One option for grounding the details of your answer is to reference real-world experience. Sharing an example of a similar problem you’ve previously solved adds detail to the answer while also demonstrating its viability.
- Design a flash sale e-commerce system
- Design a ride-sharing service
- Design a URL shortening service
- Design a search engine
Strategies for Acing the Interview
Don’t Forget to Communicate
A coding interview isn’t just about the code. The conversation between you and the interviewer is as important as the code itself. Throughout the entire process, you should talk out loud, explaining your approach. You could, for example, ask for more details or consider how your solution might apply to the job at hand.
Don’t put off explaining the code until after you’ve finished coding the solution. You might forget an important detail or run out of time. Describe every action you take and decision you make in real time.
Practice, Practice, Practice
Every developer knows that sufficient interview preparation is vital to a successful interview. However, the key is to practice smarter, not harder.
The goal of your practice sessions shouldn’t be to practice every possible question you could face. Instead, interviewing practice will expose you to enough questions to be familiar with the various types of questions and how to solve them. Even some of the most advanced coding questions are often just multiple computer science concepts combined together.
For example, one of HackerRank’s hardest dynamic programming problems (with only a 37.4% solve rate) is really a dynamic programing problem combined with a data structure problem. If asked a similar question in an interview, a developer who’d practiced arrays, priority queueing, and dynamic programming would be able to solve this problem despite never having seen it before.
Structure Responses With an Answering Strategy
While providing solutions to tough interview questions is certainly challenging, some developers find the hardest part of the technical interview to be the non-technical components. Explaining complex technical concepts through verbal communication is a tough skill to master in its own right.
Structuring your response with a tried-and-true answering method can make the interview go much smoother. Here are a few strategies to consider.
Situation, Task, Action, and Result is a great method that can be employed to answer a problem-solving or design interview question.
- Situation: Identify the situation and circumstances.
- Task: Define the problem or goal that needs to be addressed.
- Action: What approaches and technologies will you use to solve the problem?
- Result: Wrap it up by stating the outcome.
Point, Reason, Example, Point is a presentation technique that you can use to answer problem solving and design questions.
- Point: State the solution in plain terms.
- Reasons: Follow up the solution by explaining your point.
- Example: Round out your answer by contextualizing it with a real-world example.
- Point: Reiterate the solution to make it come full circle.