Cracking Data Structures Coding Interview

Sathish
5 min readOct 23, 2023

I was looking for jobs from June 2023 when layoffs were at it’s peak. I am a tech savvy technically sounded and working as a lead . I didn’t try in FAANG like companies in last 7years and interview dynamics has changed a lot.

I applied for companies through LinkedIn/Naukri/HasJob/Instahyre/ Cutshort and got some interview calls. I just prepared randomly, did some google search about the companies and their interview process.

When I attended first round(DS coding round), I was brutally trashed. There were 2 leet code questions and duration was 1hour, one was easy and the other one was medium. I was able to solve the easy one but that itself took me some time(20–30mins) to solve. For medium range question, I was able to come up with solution, but not optimised one or not able to clear all test cases. It was like going to war without proper plan and execution.

This happened with me few times, I was thinking, I am technically strong, have interviewed many people but I couldn’t crack this DS coding round. I was desperately looking for job but didn’t get any calls for few weeks. Then I started self reflecting, was looking back to understand what went wrong and where am lagging.

  1. I was not confident enough to choose the right scripting/programming language to solve coding questions, as I have worked in multiple stacks.
  2. I was not prepared in data structures, especially with LinkedLists, Trees and Graphs.

I realised, solving random questions is not going to help in solving LeetCode problems. So, I came up with a plan to approach this problem.

  1. If you are not sure/strong about choosing right programming/scripting language to solve coding questions, go with python. It has very simple syntax, easy to learn and code and have rich-in libraries. If you search solution for coding questions online, most of the solutions would be in python as you can solve real quick, easy to understand. I spent almost half a day reading blogs and watching vlogs to choose the right technology for DS round. Most of the tech vloggers suggests python for the above reason. Trust me, I was able to solve coding questions in python in just 1/4th of my time compared to hours I used to spent in other stacks. If you know the basics of programming, you can learn python in less than 2days.
  2. Now I solved my first problem. I need to prepare Data structures, I realised searching in google is going to be time consuming process and may not be sure how much depth I have to cover in each topic. Also, I wanted to learn different data structure topics in no time. I ended up subscribing with this Udemy Course. (Note — Am not working for or promoting Udemy here. You can subscribe to DS course in any Education website, but make sure course content is good, people have given better ratings and it’s aligned with what you need to learn).
  3. You can be a pro in programming, rockstar in your company, but solving leetcode problems require special skills for sure. Initially I was using leetcode.com to solve coding questions. But it lacks in grouping and you need to spend time in finding the optimised solution. So, I started following NeetCode to solve DS problems. It in-turns refers to leetcode problems only, but questions are well categorised(eg. sliding windows, two pointers etc.) It has 4groups(Basics, Blind, Neetcode 150, Neetcode all). I followed Neetcode150 and sorted problems based on difficulty. If you want to crack Google interview, I recommend you to follow NeetCodeAll.
  4. Now, I have some plan in hand, all I need is to execute and get ready for coding interviews. I started with easy level problems. Trust me, that itself took more than an hour to solve (that too not optimised solution at all). I had a clear goal in my mind, so didn’t get distracted or demotivated as it took lot of time to solve easy level problems itself. Even if you don’t know the solution, just stay on the problem statement, give enough time (at least 60mins) thinking of a solution and still you couldn’t find solution, look for the recorded solution. With Neet code grouping problems, if you are able to solve 2–3easy problems in one category, you should be able to solve the next problem in same category (eg. for sure you will know the technique, as you solved previous problem using similar technique)
  5. Once I was able to solve easy problems (not optimised solutions),I shifted my focus to optimise the solutions (especially bothering about time and space complexity). DS course has really helped in understanding the Time and Space complexities and how easily it can be calculated. Again I followed the same pattern, giving enough time to think about optimal solution, if I couldn’t come up, I then refer recorded solution to under how it can be solved.
  6. This way, I became comfortable solving easy level problems in one category and was able to crack solution in less than 5–10mins. Now, I approached toward medium and difficult level problems in same category(following the same pattern as mentioned above).
  7. Before approaching linked lists, trees and graphs, I made sure, I completed the course and felt ready to at least face these problems.
  8. I made sure to practice the following data structures — Arrays, Stacks, Queues, Linked lists, Doubly Linked lists, Trees (Binary Tree, Tree Traversal, BST), graphs, Hashmap, Searching (Binary Search) and Sorting (all sorting techniques, but focused more on Merge and Quick sort).
  9. Then I started practicing by following GeeksForGeeks, Glassdoor, LeetCode and gave a try with these problems as well.

After intense preparations for 2weeks, I got some interview calls and was able to clear technical interviews in 5–6 companies. I shared the same with few of my friends and they were are also able to crack coding round after few attempts. Then, many of my friends/colleagues started asking me how I cleared tough technical interviews. So, I thought of sharing, which will help many job seekers.

Solving leet code problems is an art, you need special skills and it’s like learning something new (not normal programming).

Trust me, if you follow the above process with discipline, you should be able to crack DS coding round in 2–3 attempts. If you want to crack Google/Facebook coding interviews, go with NeetCode All (442 problems) and definitely you need to be committed.

I will try to share about cracking System Design rounds in my upcoming blogs.

--

--

Sathish

Software Architect ★ Developer ★ Troubleshooter