๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

Free course ยท Intermediate

Interview DSA Crash Course

๐Ÿ› Way2Fresher Academy โฑ 4 weeks โญ 4.9 ๐Ÿ‘ฅ 7,200 learners ๐ŸŽ“ Certificate

Free 4 modules ยท 15 lessons Start now โ†’

What you will learn

  • State the time and space cost of your own solution in the interview without being asked twice
  • Recognise the ~12 patterns behind the vast majority of fresher interview questions
  • Write working code on paper or a plain editor, with no autocomplete and no run button
  • Talk through your approach before typing, which is what the interviewer is grading
  • Handle a question you have never seen by reducing it to a pattern you know
  • Recover from a blank moment without going silent for two minutes

Course curriculum

4 modules ยท 15 lessons ยท a worked example and a practice task in every lesson

Module 3Recursion, trees and the questions you cannot prepare for3 of 44 lessons

Weeks 3โ€“4 โ€” the shapes that appear in a second technical round, plus the recovery skills nobody teaches.

  1. Recursion and the call stack

    A recursive function calls itself on a smaller input. Every recursion needs a base case or it never stops โ€” the single most common failure in a live interview.

    The lesson

    A recursive function calls itself on a smaller version of the problem, with a base case that stops. Factorial, the sum of a list, a tree walk and binary search all have the same three parts: the base case, the smaller call, and what you do with the result. Every call sits on the stack until the innermost one returns.

    The useful skill is converting between the two. Every recursive function can be written with an explicit stack or a loop, and interviewers ask for it when recursion depth would overflow. Practise factorial and Fibonacci both ways โ€” it is the same reasoning applied twice and it comes up constantly.

    The mistake is a base case that never triggers: if n == 0 when n can go negative, or a recursive call with the same argument. If you see a recursion error, print n on each call and the missing step is almost always visible in three lines of output.

    Python
    def factorial(n):
        if n <= 1:                 # base case - stops the recursion
            return 1
        return n * factorial(n - 1)
    
    # The same thing with a loop
    def factorial_loop(n):
        result = 1
        for i in range(2, n + 1):
            result *= i
        return result
    
    # A base case that never triggers -> RecursionError. Print n to debug.

    Example factorial(n) = n * factorial(n - 1) with factorial(0) = 1 is complete; omit the base case and the answer is a stack overflow in front of the interviewer.

    Practice Write three recursive solutions by hand, each with the base case written FIRST, then verify on paper for n = 0 and n = 1.

  2. Binary trees, traversals and search

    Trees and their traversals โ€” depth-first and breadth-first โ€” cover a large share of second-round fresher questions.

    The lesson

    A binary tree is a node with a left child, a right child, and a value. Traversals are just orders of visiting: pre-order is node, left, right; in-order is left, node, right and prints a binary SEARCH tree in sorted order; post-order is left, right, node and is how you free or compute upwards. Breadth-first uses a queue and goes level by level.

    Three interview problems cover most of what is asked: how deep is the tree (recursion on both children, take the larger), is it balanced, and is a given tree a binary search tree (an in-order traversal comes out sorted). Search in a BST is a loop: go left if the target is smaller, right if larger, stop when you reach it.

    The mistake is writing a traversal that returns nothing because the recursive call was made without return. And on the BST question, checking only parent against child is not enough โ€” the value must be inside an allowed RANGE from every ancestor, which is why in-order traversal is the safe answer.

    Python
    class Node:
        def __init__(self, val, left=None, right=None):
            self.val, self.left, self.right = val, left, right
    
    def depth(node):
        if node is None: return 0
        return 1 + max(depth(node.left), depth(node.right))
    
    def inorder(node, out):
        if node is None: return out
        inorder(node.left, out); out.append(node.val); inorder(node.right, out)
        return out
    
    # In a binary SEARCH tree, the in-order traversal comes out sorted.

    Example A breadth-first traversal with a queue prints level by level; depth-first with recursion prints all of one branch before the next. The output order is the difference, and interviewers ask for both.

    Practice Implement a tree insertion and all three depth-first traversals without looking anything up, then check against a written example.

  3. When you go blank

    The recovery routine: restate the question, name the pattern family, start with the brute force, then improve it. Most candidates who are rejected went silent instead of doing this.

    The lesson

    Going blank happens to everyone, including people who have solved three hundred problems, because the interview is a different task from practising. The recovery is a procedure, not a mood: restate the question in your own words, work the smallest example by hand, then describe the brute-force solution out loud.

    Naming the brute force is not giving up; it is a floor to stand on. Say "the straightforward way is O(nยฒ) โ€” let me write the skeleton and then improve it", and you are talking, the interviewer can steer you, and partial credit is on the table. Many candidates then spot the improvement while writing the slow version.

    The mistake is going quiet and waiting for inspiration, or worse, starting to write code you cannot explain. Ask a clarifying question about the input instead โ€” size, duplicates, empty cases โ€” the answer usually hands you the pattern.

    Plain text
    Recovery procedure:
      1. Restate the question in your own words.
      2. Work the SMALLEST example by hand.
      3. Say the brute force out loud: "the simple way is O(n^2)...".
      4. Ask about the input: size? duplicates? empty?
    
    Naming the brute force is a floor to stand on, not giving up.

    Example "I do not have the optimal answer yet. A brute-force version is O(nยฒ) and would work; may I describe that and then improve it?" is a strong answer, not a confession.

    Practice Practise two problems you cannot solve: spend ten minutes narrating the brute force and the path you would explore, and never say only "I do not know".

  4. A 4-week practice plan, condensed

    Four weeks is enough for patterns, not for hundreds of problems. Two problems a day, narrated out loud, beats twenty problems read.

    The lesson

    Four weeks, one topic a week, two problems a day of which one is new and one is a repeat from three days ago. Week 1 arrays, strings and hashing. Week 2 two pointers, sliding window and sorting. Week 3 recursion, trees and BFS. Week 4 revision of everything you got wrong, typed again from scratch.

    Keep a file per problem with three lines: the pattern, the complexity, and the specific mistake you made. That file is what you revise from, not the solutions โ€” reading a solution you have already understood teaches almost nothing. Before an interview, read only your mistake file.

    The mistake is grinding new problems for hours a day and never repeating. Fluency comes from the second and third attempt at the same problem a few days apart, and that is exactly what most candidates skip because a new problem feels more productive.

    Plain text
    Wk1 arrays, strings, hashing
    Wk2 two pointers, sliding window, sorting
    Wk3 recursion, trees, BFS
    Wk4 redo everything you got wrong, typed from scratch
    
    2 problems a day: 1 new + 1 repeat from three days ago.
    Keep a file: the pattern . the complexity . the mistake you made.

    Example A day of ten problems read and not solved is worth less than two solved on paper with the complexity written underneath.

    Practice Book 28 daily slots in your calendar, two problems each, and mark each one solved-on-paper-yes-or-no.

Show all modules on one page

About Interview DSA Crash Course

Solve the interview problems that are actually asked of freshers โ€” out loud, under time, on paper โ€” in four weeks.

Final-year students and graduates with a first round of coding interviews ahead, who can already write a loop and freeze when the timer starts.

What you will be able to do at the end

  • State the time and space cost of your own solution in the interview without being asked twice
  • Recognise the ~12 patterns behind the vast majority of fresher interview questions
  • Write working code on paper or a plain editor, with no autocomplete and no run button
  • Talk through your approach before typing, which is what the interviewer is grading
  • Handle a question you have never seen by reducing it to a pattern you know
  • Recover from a blank moment without going silent for two minutes

How the course is structured

3 modules and 11 lessons, arranged so each one ends with something you have built. Every lesson carries a worked example and a practice task โ€” the practice is the course, the reading is only the setup. Plan for 4 weeks ยท about 8 hours a week.

The full syllabus โ€” every lesson, its example and its practice task โ€” is in the Course curriculum below. Nothing is locked and nothing needs an account.

Your weekly routine

  • Two problems a day, solved on paper first and typed afterwards.
  • One narrated mock interview a week โ€” out loud, timed, no pausing to look anything up.
  • Write the complexity of every solution before typing it, even when you are sure.

What you will have built by the end

  • A pattern notebook: every problem you solve, its pattern and its complexity in one line
  • Four recorded practice interviews narrated out loud
  • A full mock interview from the Career Portal's AI mock-interview tool, with its feedback written down

Where this leads for a fresher

  • Fresher software engineer at a product company
  • Trainee / graduate engineer at a services company
  • Second-round technical interviews you have already qualified for
  • Campus and off-campus hiring drives

Titles vary between companies; the evidence does not. A deployed project, a set of queries you can explain, or a case study with real testing behind it is what a fresher interview has to work with.

Frequently asked questions

How many problems should I solve before interviewing?

Around 60โ€“80 real ones, each narrated out loud, covers the patterns fresher interviews actually use. Numbers in the hundreds without narration is the common trap: you recognise but cannot produce.

I know coding but I freeze in interviews. Is that fixable?

Yes, and it is the most fixable part. Narrating every practice problem out loud, including one full mock a week, is the training โ€” not more reading. Take the free Career Pulse check: communication is one of the areas it scores, and it will show you how much of your gap is interview skill rather than knowledge.

Is this course free?

The lessons, examples and practice tasks are free, and the AI mock-interview tool on the Career Portal is free to use.

Do I need data structures from my college syllabus?

No. Arrays, strings, maps, sets, trees and recursion cover the overwhelming majority of fresher questions. This course teaches exactly those and skips the theory you will not be asked.

Not sure which of these you need first? The free Career Pulse check scores your skills, communication and goal clarity in about three minutes and tells you which gap to close first. Take the free check.