Skip to the page

Interview rounds · 22 concepts

DSA for coding rounds

The data structures and patterns that coding rounds ask, taught the same way for Java, Python, C++ or any other language.

Part 1 · 4 concepts

Foundations

  1. 01

    Big-O in plain words

    Big-O says how time or memory grows when the input size n grows, keeping only the biggest term: one loop is O(n), a loop inside a loop is O(n²), and halving the work…

  2. 02

    The collections you will use

    Every coding round uses the same few containers in Java, Python and C++. You must know each one's name, its cost for each operation, and its traps (which heap is a…

  3. 03

    Arrays and strings

    Most array and string problems are solved in one pass with a few running variables, a prefix sum, or in-place writes with a write pointer. Keep every call inside the…

  4. 04

    Hash maps and sets

    A hash map or hash set turns 'have I seen this?' and 'how many of these?' into O(1) average lookups, which is the move behind two-sum, grouping, counting and removing…

Part 2 · 6 concepts

Linear patterns

  1. 05

    Two pointers

    Two pointers walk a sorted array or a string from both ends (or at two speeds), moving the pointer that can improve the answer, so a pair search drops from O(n²) to…

  2. 06

    Sliding window

    A sliding window keeps a range [left, right] and updates its state as right grows and left shrinks, so problems about the best contiguous substring or subarray run in…

  3. 07

    Stacks and queues

    A stack (last in, first out) matches nested or 'most recent' things like brackets, undo and expression parsing, a monotonic stack finds the next greater element in…

  4. 08

    Binary search

    Binary search halves a sorted range (or a range of possible answers) each step by testing the middle, giving O(log n), and most bugs come from the loop condition and…

  5. 09

    Sorting and intervals

    Sort intervals by start, then one pass merges overlaps, and sorting start and end times separately (a sweep line) tells how many overlap at once; the comparator and the…

  6. 10

    Linked lists

    A linked list is nodes with next pointers, so problems are about re-wiring pointers safely: keep a reference before you overwrite next, use a dummy head for edge cases…

Part 3 · 5 concepts

Recursion, trees and heaps

  1. 11

    Recursion

    A recursive function solves a small case directly (the base case) and calls itself on a smaller input, and every call waits on the call stack. So always state the base…

  2. 12

    Backtracking

    Backtracking builds a solution step by step, tries each choice, recurses, then undoes the choice, which lists all subsets, permutations or combinations, and pruning…

  3. 13

    Trees and traversals

    A tree is visited depth-first (pre-, in- or post-order, with recursion or a stack) or breadth-first level by level with a queue, and most tree questions are one small…

  4. 14

    Heaps and priority queues

    A heap is a tree stored in an array that keeps the smallest (or largest) item on top, giving O(log n) push and pop and O(1) peek. Use it for top-k, merging sorted lists…

  5. 15

    Tries for prefix search

    A trie stores words character by character in a tree, so 'all words with this prefix' costs O(length of prefix) to find the node plus the size of the results, which is…

Part 4 · 3 concepts

Graphs and grids

  1. 16

    Graph basics

    Store a graph as an adjacency list. Use BFS for shortest paths when edges have no weights, DFS for reachability and cycles, and Kahn's algorithm (in-degrees plus a…

  2. 17

    Matrix and grid BFS

    A grid is a graph where each cell links to its 4 (or 8) neighbours, so islands, flood fill, minesweeper reveal and 'spread' problems are BFS or DFS with bounds checks…

  3. 18

    Union-find (light)

    Union-find keeps groups of connected items with a parent array, where find walks to the group's root (with path compression) and union joins two roots, making 'are…

Part 5 · 2 concepts

Dynamic programming

  1. 19

    Dynamic programming, the intro

    Dynamic programming solves a problem from answers to smaller overlapping sub-problems, either top-down with memoised recursion or bottom-up with a table. It works once…

  2. 20

    Two-dimensional DP on strings and grids

    When the state needs two indices (a cell row and column, or a position in each of two strings), dp[i][j] is filled from its top, left and diagonal neighbours, which…

Part 6 · 2 concepts

Bits and string matching

  1. 21

    Bit tricks that are actually asked

    A few bit tricks (x & (x - 1) clears the lowest set bit, XOR cancels pairs, masks store sets of flags) solve the bit questions that coding rounds ask, and the integer…

  2. 22

    String matching: built-ins, KMP and safe patterns

    Finding a pattern in text is O(n·m) done naively and O(n + m) with KMP's prefix function. In real code, use the built-in find, and never build a regular expression from…

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview