The course
Coding interview course
66 lessons across 12 topics: 24 that teach the ideas, and 42 interview questions you solve and test in the editor.
01 Arrays
Learn
- Arrays
Understand array indexing, insertion, iteration, and resizing, then practice the invariants used in array and matrix interview problems.
Questions
- Implement an Array
Build an array abstraction and reason about indexed access, insertion, removal, capacity, and the costs of moving existing elements.
- Walk a Matrix
Practice traversing a two-dimensional matrix while tracking row and column boundaries and handling small or empty inputs.
- Product Array
Compute each array position from the product of the other values without division. Work through prefix/suffix state and zero-value cases.
- Valid Sudoku Board
Check Sudoku rows, columns, and subgrids for duplicate values. Practice mapping board positions to the constraints they must satisfy.
- Best Time to Buy and Sell Stock
Find the best single buy-and-sell opportunity by tracking an earlier minimum. Practice ordering constraints and decreasing-price inputs.
02 Essential Concepts
Learn
- Big O Notation Time and Space Complexity
Analyze how interview solutions grow with input size. Compare loops, recursion, auxiliary memory, and common complexity classes.
03 Hash Tables
Learn
- Hash Tables
Learn how hashing maps keys to storage, why collisions matter, and how maps and sets support common interview optimizations.
Questions
- Implement a Hash Table
Build a hash-table implementation, store and retrieve key/value pairs, and examine how collisions affect correctness and performance.
- Catch the Hacker
Identify a repeatedly duplicated email by counting frequencies. Compare repeated scans with a map-based pass through the input.
- Target Two Sum
Find two distinct indices whose values reach a target. Compare pair enumeration with a hash-map solution and test duplicate values.
04 Strings
Learn
- Strings
Study string traversal, character representation, immutability, and construction costs before practicing text interview problems.
- Palindromes, Permutations, Anagrams
Distinguish palindrome order, permutation arrangements, and anagram frequency counts, then choose the state each text problem needs.
Questions
- Group Permutations of Palindromes
Practice grouping strings by character relationships and reasoning about which arrangements can form a palindrome.
05 Recursion
Learn
- Recursion
Trace recursive execution, define a smaller subproblem, and connect base cases and return values to a clear correctness argument.
Questions
- Sum Digits
Compute a number’s digit sum using arithmetic. Practice recursive decomposition, termination, and tests for single-digit inputs.
- Generate All Permutations
Enumerate input arrangements while managing choices and restoring state. Analyze the output size and test small permutation examples.
06 Searching and Sorting
Learn
- Logarithms and Time Complexity
Understand why repeated halving produces logarithmic work and apply that reasoning to search intervals and recursive algorithms.
- Searching and Binary Search
Search sorted data by narrowing a candidate interval. Practice boundaries, midpoint updates, and the conditions that guarantee progress.
- Sorting
Compare sorting approaches, runtime assumptions, and the ways sorted order changes an interview problem’s available solutions.
Questions
- Interview Scheduler
Work through an interview scheduling problem and practice using ordered information to reduce the search for a valid answer.
- Shifted Search
Find a target in a shifted sorted array by reasoning about ordered intervals and choosing which half can still contain the answer.
- Sorted Matrix Search
Use a matrix’s ordering constraints to reduce the search space. Track boundaries and test targets at edges or outside the data.
- Age Sort
Explore how a restricted value range can change a sorting problem. Compare counting-based work with general comparison sorting.
- First Bad Version
Find a transition in an ordered sequence using a predicate. Practice binary-search interval definitions and edge-boundary cases.
07 Linked Lists
Learn
- Linked Lists
Understand linked-list structure, traversal costs, and the pointer relationships behind insertion, deletion, and reversal.
- Pointers
Reason about references, node identity, and reachability so pointer updates do not lose the remainder of a list or tree.
Questions
- Implement a Linked List
Build linked nodes and list operations, maintain head and tail relationships, and test empty and single-node structures.
- Combine Blockchains
Practice combining linked chains while preserving their nodes and maintaining the relationships needed to traverse the result.
- Reverse a Linked List
Reverse a list by tracking the previous, current, and next nodes. Explain the invariant and handle empty and single-node inputs.
- Mirror Delete
Work through a linked-list deletion exercise with careful reference updates, boundary checks, and tests that preserve reachable nodes.
08 Stacks and Queues
Learn
Questions
- Implement a Queue
Implement enqueue and dequeue behavior while maintaining first-in-first-out order and handling empty-queue transitions.
- Implement a Stack
Implement push, pop, and peek, maintain the top of the stack, and reason about operation costs and empty-state behavior.
- Max Min Stack
Support stack operations while tracking minimum and maximum values. Practice duplicate values and restoring earlier aggregate state.
- Valid Brackets
Validate bracket ordering with a stack of unmatched openings. Test mismatched types, unfinished openings, and closing-first inputs.
09 Trees
Learn
- Trees
Learn tree terminology and recursive structure, then prepare for traversal, depth, ancestor, and binary-search-tree exercises.
- Tree Traversal: In-Order, Pre-Order, Post-Order
Compare traversal orders by changing when each node is processed. Trace recursive calls and distinguish traversal from search-tree ordering.
- Binary Search Trees
Understand the ordering rules that guide binary-search-tree operations and how tree height affects search performance.
Questions
- Implement a Binary Search Tree
Build a binary search tree, preserve its ordering contract during updates, and test search paths and empty-tree behavior.
- Binary Tree Max Depth
Compute a tree’s depth from its subtrees. State the empty-tree convention and compare balanced and chain-shaped inputs.
- BST Validate
Check the complete binary-search-tree ordering rule, including ancestor constraints that a parent-only comparison can miss.
- Closest Common Ancestor in Binary Tree
Find the shared ancestor of two nodes by reasoning about subtree results and the relationship between node identity and ancestry.
10 Graphs
Learn
- Graphs
Model relationships with graph nodes and edges, compare representations, and prepare for reachability and traversal exercises.
- Depth-First Search
Traverse a graph by following branches, track visited nodes to handle cycles, and reason about recursive or explicit stack state.
- Breadth-First Search
Traverse by distance with a queue, avoid duplicate discoveries, and reconstruct shortest paths when edges have equal cost.
Questions
- Implement a Graph
Represent vertices and edges, maintain neighbor relationships, and prepare a graph structure for traversal and reachability queries.
- Pilot a Rocket
Find a route through a satellite network. Practice BFS discovery order, parent tracking, cycles, and an unreachable destination.
- Count Islands
Count connected land regions in a matrix. Compare DFS and BFS, mark visited cells, and test disconnected and diagonal land.
- Robot Maze
Determine whether a robot can reach an exit under the allowed movement rules. Practice grid bounds, blocked cells, and path choices.
11 Dynamic Programming
Learn
- Subproblems and Overlapping Subproblems
Identify repeated smaller decisions and define state precisely before using caching or a dynamic-programming table.
- Memoization
Turn repeated recursive work into reusable results. Choose complete cache keys and distinguish missing results from valid zero values.
- Bottom-Up vs. Top-Down
Compare memoized recursion with tabulation, choose a valid evaluation order, and reason about stack and table storage.
- Dynamic Programming
Develop a recurrence, identify repeated states, and connect memoization and tabulation to interview problem-solving strategies.
Questions
- Vending Machine
Work through a vending-machine interview problem by identifying choices, smaller subproblems, and the state needed to reuse results.
- Three Moves
Define transitions for a constrained-movement problem and practice solving repeated subproblems without recomputing each path.
- Steal Packages
Maximize a total without taking adjacent entries. Derive skip/take decisions and compare recursive, memoized, and iterative approaches.
12 JavaScript
Learn
- Why does JavaScript Get its Own Topic
Connect general algorithm skills with JavaScript-specific behavior, browser programming, and practical utility implementations.
Questions
- JavaScript Interview Questions
Practice explaining JavaScript behavior and implementation choices alongside algorithm exercises and practical coding questions.
- Fix 'this'
Trace JavaScript receivers and callback invocation so you can explain and repair unexpected this values in interview code.
- Array Methods
Practice array-method behavior, callback arguments, iteration, and edge cases by implementing familiar JavaScript operations.
- Build a JavaScript Promise
Explore asynchronous state, fulfillment, rejection, and chaining by building a teaching implementation of promise behavior.
- Pub-Sub and Event-Driven Programming
Implement event subscription and publication, track listeners, and connect the pattern to event-driven JavaScript applications.
- Debounce
Implement a debounce that waits for activity to settle. Trace timers, preserve arguments and this, and compare it with throttling.
- Throttle
Limit callback frequency during repeated events. Explain cooldown windows, trailing updates, and how throttling differs from debounce.
Course
Programming language preparation
These free companion guides cover collections, language behavior, and worked algorithms in ten programming languages. The language options in each lesson editor depend on the exercise and the deployment’s configured runner.