DEV Community

Cover image for How to ace the coding interview in 2022
Sanjana Bhat
Sanjana Bhat

Posted on • Updated on

How to ace the coding interview in 2022

Coding was the most I prepared for.
a) Because I love solving coding puzzles and
b) I was initially getting rejected in the first rounds, that made me get back to this and keep on leetcoding. 😭

1. Preparation

This stage is what I call, pre-leetcode.

  • Get comfortable with algorithms basics. quick sort, merge sort, binary search and the likes.
  • Really know Big O notation. That means knowing what is the runtime and spacetime complexities for recursion, data structures like trees and graphs and so on.
  • Know language specific constructs to work with date, time and regular expressions.
  • Revising is important. I made notes on evernote and would only revise this the day before my interviews.

2. How to use LeetCode effectively

  • Premium account is definitely worth it.
  • LeetCode has these really good prepare tracks - for Graphs, LinkedLists, Arrays, Strings, Trees and I found these to be the best. This is a great place to brush up the concepts.
  • LeetCode has more than 2000 coding questions. So it is easy to feel overwhelmed and lost. Create a list and stick to it. I followed the Blind75 list, and it is great.
  • When you have an upcoming interview, do some of the company tagged questions. Also check the Discuss section for interview experiences.
  • Avoid the pitfalls. LeetCode platform emphasizes on the run time of solutions. So it is easy to fall into the trap of writing bad code that runs really fast. In a real interview, candidates are also graded on code quality. Make a habit of following these coding guidelines.
  • Consistency is key. Solving one question everyday is better than solving 10 questions only on the weekends.

3. Online Tests

Some companies have this qualifying round before the on-site rounds. Now, online tests are whole together a different ball game. I have generally detested these. But there are some points to keep in mind while you take an online test.

  • These tests also monitor your activity along with grading your code. So, do not switch tabs.
  • Do NOT copy paste. Some sites state that you are free to work on your IDE and then run the code on the site. But it is better to avoid doing that.

4. During the interview

  • Keep your introduction short. This gives you more time to write code.
  • When you get a question, read that out loud, make sure you understand it fully.
  • Come up with your own boundary test cases. Ask clarifying questions like "how long can the input string be" or "what is expected to happen if we pass an empty array". It is a red flag if a candidate jumps straight to solving a problem without asking the questions first.
  • Discuss the approaches with your interviewer (if you know more than one, that is). Take hints - your interviewer will guide you here. May be they are looking for the fastest implementation, or they are looking for the one that uses constant space. Your solution will be based on this discussion.
  • While writing code, keep thinking out loud. Keep talking about the design choices you are making.
  • Listen to the hints. It is easy to get absorbed in our train of thought. But when you get a hint from the interviewer, it is time to take a pause and re-orient.
  • Make use of TODOs. When you don't have enough time, just write an abstract function that does the job and get to its implementation if time permits.

5. Resources

(all non-affiliated links)

  1. Algorithms by Sedgewick and Wayne Best book on algorithms. I especially liked the section on Tries and Union Find. The code examples in the book are quite elaborate, so it is better to rely on examples from sites GeeksForGeeks or Techie Delight.
  2. Cracking the Coding Interview Best book to get started - with Linked Lists, Trees, Strings and Arrays. Clean code examples. But alas, in 2022, this book is not enough.
  3. Elements of Programming Interviews Written by former Googlers, this book is great after finishing Cracking the Coding Interview. I really liked the code examples here and the precise explanation.
  4. LeetCode My 75 List My own curated list based on the very famous Blind 75 list.

Top comments (3)

pravemp profile image

I would like to get a perspective on the technical interviews and system design rounds as well.

sanjbhat profile image
Sanjana Bhat

Hey @pravemp, article on System Design is coming soon :) Thanks for your encouraging comment.

sanjbhat profile image
Sanjana Bhat

Hey @pravemp
System Design article is out ! Check it out here
Let me know what you thought :)