Step by Step Guide for Cracking the Coding Interview

Most programmers need to realize the importance of data structure and algorithms as early as possible in their careers. The reason would be simple: knowledge of this subject helps us grow as better programmers and master computer science. On another side, the interviewer uses DSA to test candidates during the interview. It provides them a simple approach to evaluate problem-solving skills, basic computer science knowledge, and clarity of thought.

Mastering algorithms and data structure require motivation, proper guidance, hard work, and a continuous learning plan. If someone wants to start an awesome journey, then answer to these questions are important:

  • How to develop a long-term interest in algorithms and data structure?
  • How to prepare a continuous learning plan to crack the coding interview?
  • What are the essential concepts and problem-solving approaches?
  • What are the critical activities which help us to learn quickly?
  • How to prepare for the coding interview in a given duration?

Let's dive deep and explore answers to these questions!

Step 1: Building a long term Motivation

A long-term vision is essential! We need to think and explore: why learning data structure and algorithms are crucial for career growth in the tech industry? What are its real-life applications? Here are some critical ideas:

  • Algorithms is a 21st-century skill for a programmer where every understood concept and problem-solving ideas are like a gem.
  • There is precious learning in each error or bug, and we need to prepare for the ups and downs.
  • Once we have a basic knowledge of algorithms and data structure, our problem-solving interest will increase more and more. Never giving up is the key!

why data structure and algorithms are important?

Step 2: Understanding data structure and algorithms syllabus for coding interview

After preparing the mind, now our first goal would be to prepare a list of essential topics important in data structure and algo. We can especially focus on real-life applications to understand the use case of algorithms.

Algorithmic Thinking

Algorithmic Puzzles, Brain Teaser, counting, summation, numbers theory, permutation, induction, recurrences, basic probability

Fundamentals of Programming

Data Types and Variables, Operators and Expressions, Control Statements, Loops and Iteration, Function and Properties, Pointer/Reference, Arrays and Strings, Memory Management, Class and Objects.

Fundamentals of Algorithms

  • Properties and real-life applications of algorithms
  • Complexity Analysis: Input size, Rate of growth, Worst-case analysis, Big-O notations, Time complexity, Space Complexity
  • The idea of Iteration: Properties, Patterns of iterative problem-solving like building partial solution using a single loop, nested loops, two pointers, sliding window, etc., Analysis of loop
  • The idea of Recursion: Properties, Patterns of recursive problem-solving like decrease and conquer, divide and conquer, etc., Analysis of recursion
  • Sorting algorithms: Bubble sort, Selection sort, Insertion sort, Merge sort, Quicksort, Heap sort, Counting sort, Radix sort, Properties and comparisons of sorting algorithms.
  • Searching algorithms: Binary Search, Exponential search, Interpolation search
  • The idea of Hashing and Hash Table: Direct address table, Properties of a hash function, Basic operations (Insert, Delete, and Search), Patterns of problem-solving using a hash table, hashing by chaining, hashing by open addressing.

Linear Data Structures

Properties, Structure, Implementation, Basic operations, Patterns of iterative and recursive problem-solving and Real-life applications

  • Array: 1D Array, 2D Array, String, Dynamic Array, Amortised analysis
  • Linked list: Singly linked list, Doubly linked list, Circular linked list
  • StackQueue, and Dequeue

Non-linear Data Structures

  • Binary Tree: Properties, Structure, DFS Traversals (Pre-order, In-order, and Post-order), BFS traversal, Basic Operations and Patterns of problem-solving using BFS and DFS traversals, other Problem-solving patterns
  • Binary Search Tree: Properties, Structure, BST building, Basic BST operations, BST sort, Patterns of problem-solving in BST, Self-balancing BST, Real-life applications, Comparison with Hash Table.
  • Heap: Properties, Structure, Heap building, Basic heap operations, Heap sort, Patterns of Problem solving, Real-life applications
  • Dictionary and Priority queue: Implementations and comparisons of time complexities: Array, linked list, BST, heap(Priority queue) and Hash Table (Dictionary), Basic operations, and Real-life applications
  • Advanced-Data Structures (Properties, Structure, Basic operations, Patterns of problem-solving and Real-life applications): Trie, Segment Tree, binary indexed tree, K-Dimensional Tree, n-ary tree, suffix tree
  • Graph: Properties, Structure, Types, Adjacency Matrix, Adjacency List, BFS and Its properties, DFS and Its properties, Problem-solving using DFS and BFS traversals, Topological sorting, shortest path algorithms, minimum spanning tree, Problem-solving patterns

Algorithm Design Techniques

Properties, Patterns of problem-solving and Real-life applications

  • Dynamic Programming: Time memory tradeoff, optimization problems, counting problems, designing optimal substructure, Top-down approach, Bottom-up approach, Bit-masking, Problem-solving patterns using a 1D array, Problem-solving patterns using a 2D array, Problem-solving patterns using a 3D array
  • Greedy Algorithms: Greedy choice property, patterns of Problem solving
  • Backtracking: Exhaustive Search, Recursive and Iterative Backtracking, Branch and Bound
  • String Algorithms: String matching and patterns of Problem solving
  • Mathematical Algorithms: Numbers theoretic algorithms, Bitwise algorithms, Randomised algorithms

Coding Interview Preparation

  • Continuous practice of coding questions
  • Profile and Resume Building
  • Preparation via Mock Interview
  • Company-specific interview process research
  • Behavioral Interview Preparation

Step 3: Collecting the best Resources for Learning and Practice

Our next goal is to collect the best learning resources - books, blogs, talks, pdf, courses, etc. Internet could be handy for this. We need to follow the authentic sources and organize them according to the above syllabus. Here is the list of some best learning resources:

Data Structures and Algorithms for beginners

Fundamentals of Programming

Data Structures and Algorithms for advanced learners

For the Advanced Programming Concepts

For the Competitive Programming

  • Competitive Programming HandBook by Anti Laaksonen: Time complexity, Data Structures, Sorting, Backtracking, Greedy, Dynamic Programming, Range queries, Bit Manipulations, Graph Algorithms, Tree Algorithms
  • Project Euler (https://projecteuler.net)
  • Codeforces (https://codeforces.com)

For the data structures and algorithms interview

Step 4: Finding a good mentor and learning community

Our next goal should be to find a good mentor. A mentor can be a person having good conceptual understanding and problem-solving skills. A good mentor can help us in several ways:

  • Learning fundamentals
  • Mastering problem-solving approaches
  • Handling critical doubts
  • Coding interview preparation
  • Building a long term motivation

In addition to this, an excellent collaborative environment can also work as a catalyst. We can form a group of 2-3 people with similar goals and schedule a weekly discussion. Working as a peer or observer for each other would help to bridge the gap of strengths and weaknesses.

If possible, we can also join some groups or online communities on social media to learn from the experiences of other programmers. It can also help in resolving DSA doubts and communicating ideas among the diversity of learners.

Step 5: Preparing a continuous learning and Interview preparation plan

We are assuming that any professional or student is ready to strategically give an average of 25 hours/week. Here is a proposed time management plan that one can customize quickly based on personal learning needs.

  • Minimum time on weekdays = 15 Hours (3 hours/weekday)
  • Minimum time on weekends = 10 Hours (5 hours/weekend)

Based on experience, let's assume:

  • Solving one problem on paper with pseudo-code takes 30 minutes on average
  • Solving one problem with well-written code takes 1 hour on average
  • 1 Mock Interview takes 1 hour on average

4-Week Revision and Interview Preparation Plan

This is recommended for advanced learners who want to revise concepts and warm-up problem-solving skills. Such learners should have a good understanding of algo and data structures, and programming concepts.

  • Minimum estimated time = 25 x 4 = 100 Hours
  • Minimum coding problems to practise = 75
  • Concept revision and Problem-solving Research = 25 Hours
  • Problem-solving on paper with pseudocode = 25 Hours (at-least 50 coding questions)
  • Problem-solving with coding practice = 25 Hours (at-least 25 coding questions)
  • Doubt Resolution + Behavioural Interview Preparation + Mock Interviews = 25 Hours

8-Week Revision and Interview Preparation Plan

This is recommended for advanced learners who want to revise concepts and sharpen problem-solving skills. Such learners should have basic problem-solving skills in data structure and algorithms and good knowledge of programming concepts.

  • Minimum estimated time = 25 x 8 = 200 Hours
  • Minimum coding problems to practise = 150
  • Concept revision and Problem-solving research = 50 Hours
  • Problem-solving on paper with pseudocode = 50 Hours (at-least 100 coding questions)
  • Problem-solving with coding practice = 50 Hours (At-least 50 coding questions)
  • Doubt Resolution + Behavioural Interview Preparation + Mock Interviews = 50 Hours

12-Week Learning and Interview Preparation Plan

This is recommended for intermediate learners who want to learn advanced DSA concepts and sharpen problem-solving skills. Such learners should have a basic understanding dsa and programming concepts.

  • Minimum estimated time = 25 x 12 = 300 Hours
  • Minimum coding problems to practise = 200
  • Concept learning/revision and Problem-solving research = 100 Hours
  • Problem-solving on paper with pseudocode = 50 Hours (at-least 100 coding questions)
  • Problem-solving with coding practice = 100 Hours (at least 100 coding questions)
  • Doubt Resolution + Behavioural Interview Preparation + Mock Interviews = 50 Hours

24-Week Learning and Interview Preparation Plan

This is recommended for beginners who want to learn fundamentals and sharpen problem-solving skills to succeed in an interview. Such learners should have basic programming knowledge.

  • Minimum estimated time = 25 x 24 = 600 Hours
  • Minimum coding problems to practise = 300
  • Concept learning and Problem-solving Research = 300 Hours
  • Problem-solving on paper with pseudocode = 100 Hours (at-least 200 coding questions)
  • Problem-solving with coding practice = 100 Hours (at least 100 coding questions)
  • Doubt Resolution + Behavioural Interview Preparation + Mock Interviews = 100 Hours

Step 6: Starting Continuous Learning Activities

Concept Learning / Revision

We need to learn concepts in the proper order of dependencies. If possible, preparing a self note and writing down ideas in a visual format would help a lot in fast revision.

We also advise planning a brainstorming session around each topic with a peer or colleague. If any DSA concepts are challenging to understand, mark them, revisit them later or take help from a mentor. Continuously iterating and never giving up is a basic idea for mastering DSA concepts.

Top 20 Data Structure and Algorithms concepts

Important Data Structure and Algorithms ideas

Problem-solving Research

Finding various patterns via coding problems is one of the best approaches to master the problem-solving skill in DSA. But the critical question is - what are the important problem-solving ideas to learn? What would be the best approach to solve a coding problem? Before starting problem-solving, we recommend doing an in-depth analysis of each problem-solving approach via 3-4 coding problems related to it.

Top 20 algorithms to learn Problem-solving

best algorithms to master problem solving in DSA

Top 10 problem-solving ideas to master

Top 10 problem solving approches to crack the coding interview

Problem-solving on Paper and Coding Practice

To master problem-solving, paper or a whiteboard can be a handy tool to practice visualisations, solution steps, and pseudo-codes. Writing down algorithm steps and necessary details can help us in designing efficient solutions.

After designing an efficient pseudo-code, our final aim must be to translate each line of pseudo-code into the correct code. Never forget to test code with various input-output data, edge cases, and all boundary conditions. Now once we are done with writing code in a programming language, take care of the following things: 

  • Does this code provide the correct output for every set of inputs?
  • Can we optimize the code further? Always try to improve the code! If possible, look back, analyze it once again, and find a better solution.
  • How can we improve the readability of the code?

Note: For coding practice, we recommend leetcode. One can find several coding problems organised according to the different difficulty levels.

steps to coding problem solving

Resolving Critical Doubts

Whenever we start learning algorithms and data structure, doubts frequently occur, however big or small. Sometimes critical doubts work as a roadblock in moving ahead. But our aim must be to take every doubt constructively and try to search for a correct answer. Even we should believe doubts as a natural part of learning which could take us to the next level of conceptual depth.

If there is a doubt, first try to resolve it personally. If we fail to get an answer in limited duration, then there can be several ways to get it fixed:

  • Discussing it with our peer or colleague
  • Getting in touch with a personal or course mentor.
  • Posting the doubts in the coding or learning community.
  • Ignoring the doubts for a moment, noting them down, and revisit later with a fresh approach. Sometimes doubts are related to the later part of the concept's journey.

Behavioral Interview Preparation

If you are preparing for a dream job, then behavioral interviews are essential parts of the interviews. Most programmers underestimate this and do little or no preparation. One of the popular misconceptions is: behavioral interviews are less critical than technical interviews. But the truth is just the opposite: a behavioral interview is one of the vital factors if we want to stand out among several potential candidates.

Behavioral interviews help the interviewer discover how you make decisions in critical situations and decide if you are fit to work with them. So from the interviewer's perspective, it is as essential as our coding interviews.

The idea of behavioral interviews differs from company to company, depending on their values and culture. Here are some tips to prepare for the behavioral interviews:

  • Practice good communication skills
  • Read the job description more than twice
  • Research the industry and company
  • Prepare for common questions
  • Make your sales pitch clear
  • Speak the correct body language
  • Have smart questions for the interviewers
  • Be positive, authentic, and truthful in your answers
  • Stay optimistic and prepare for the challenge

We should have at least one good example of:

  • An interesting technical problem you solved
  • An interpersonal conflict you overcame
  • Some unique execution story about a past project
  • Leadership or ownership
  • Question about the company's product/business
  • Question about the company's engineering strategy.

Interview Preparation via Mock Interviews

We should practice some mock interviews before attending an actual coding interview. The best idea would be to find a partner with similar career goals and simulate mock interviews with each other. At the end of the interview, both the interviewer and interviewees can exchange feedback for improvement. 

When we get feedback from another person, we can identify what we need to work on. Knowing where we need to improve is crucial for creating a plan for a tech interview. We can also record the mock interview session and use the footage to enhance body language for the actual interview.

Things to keep in mind

  • Ensure that the pairing partner has basic knowledge and problem-solving skills in data structures and algorithms.
  • Use a timer to limit 45 minutes for the mock interview because most coding interviews last around 45-60 minutes.
  • Try to prepare your partner and ensure all checklists to simulate it as an actual tech interview. 
  • After the completion of the mock interview, now take the interviewer's seat. It will help you understand what companies are looking for when evaluating a candidate.

Tips for Smart Learning

  • Our goal must be to cover at least 80% syllabus and prioritise the topics based on strengths and weaknesses. A topic that requires more time should get more time.
  • Doing a weekly critical review could help us to understand the progress. We need to think — what is the further scope of improvement in the topic? What is the current level of our problem-solving ability? For the fact-based view, we recommend rating each topic on a scale of 1 to 10.
  • Few ideas always come during learning DSA: Brute force solution, efficient solution, boundary conditions, time and space complexity analysis, coding style. Keep preparing notes if you find something unique or essential patterns.
  • In the starting journey, rather than solving many problems, focus on the top 100 coding interview questions. The best idea would be to pick famous coding interview problems which can be solved using various techniques.
  • Learn to visualize critical operations, implementations, and use cases of each data structure.
  • Never mind going through the same concepts and problems again and again. This would help in figuring out hidden ideas. Focus on reason and never try to memorise!

Tips for cracking the coding interview

We need to analyze the different interview scenarios and prepare a unique strategy. It would help in gaining confidence and a competitive advantage. Learn from the mistakes and keep improving! Here are some essential tips to keep in mind:

  • After getting the problem, never waste time trying to think in your head. Get your thoughts down on paper, draw visualisations, write different test inputs, outline how you would get the given output by hand, write pseudocode steps, and think about translating it into code.
  • Don't put yourself in a hurry to design an optimal solution at the start. If possible, start with brute force or the most apparent correct answer and improve the solution further.
  • Communication plays a vital role during a an interview. Keep telling the interviewer how you are trying to approach the problem and discuss the most challenging part you face. Our goal should be to get all the relevant details and hints to reach an efficient solution.
  • Make ensure that you are working as a team member to solve the problem. An interviewer is looking for a team player who can solve problems using good collaboration skills.
  • Don't get discouraged if you'll get stuck. Even the interviewer is looking for your ability to think about the problem from various angles.
  • Think out loud and explain what you know about the solution idea. Explain what you thought might work and why it won't work. An interviewer might give you a hint.
  • Try to apply common problem-solving ideas or patterns. This could help you design efficient solutions quickly. Some problem-solving approaches come up, again and again, during problem-solving.
  • Stop looking for tips and tricks. This will not help in getting a dream job.
  • Use descriptive variable names and a good coding style.
  • Test solution for all the edge cases.

A final motivation!

A long-term vision, hard work, and consistency are the keys to mastering algorithms and data structure. Always remember this quote - " If the mind is weak, then the situation becomes a problem; if the mind is balanced, then the situation becomes a challenge. But if the mind is strong, then the situation becomes an opportunity". Enjoy learning, Enjoy coding, Enjoy algorithms!

If you have any ideas/queries/doubts/feedback, please comment below or write us at contact@enjoyalgorithms.com.

Our Weekly Newsletter

Subscribe to get well-designed content on data structures and algorithms, machine learning, system design, oops, and mathematics. enjoy learning!

We Welcome Doubts and Feedback!

More Content From EnjoyAlgorithms