donnemartin
interactive-coding-challenges
Python

120+ interactive Python coding interview challenges (algorithms and data structures). Includes Anki flashcards.

Last updated Jul 8, 2026
31.6k
Stars
4.6k
Forks
75
Issues
+27
Stars/day
Attention Score
80
Language breakdown
Python 100.0%
C++ 0.0%
โ–ธ Files click to expand
README


interactive-coding-challenges ============

Binder

120+ continually updated, interactive, and test-driven coding challenges, with Anki flashcards.

Challenges focus on algorithms and data structures found in coding interviews.

Each challenge has one or more reference solutions that are:

  • Fully functional
  • Unit tested
  • Easy-to-understand
Challenges will soon provide on-demand incremental hints to help you arrive at the optimal solution.

Notebooks also detail:

  • Constraints
  • Test cases
  • Algorithms
  • Big-O time and space complexities
Also included are unit tested reference implementations of various data structures and algorithms.

Challenge Solutions



Anki Flashcards: Coding and Design


The provided Anki flashcard deck uses spaced repetition to help you retain key concepts.

Great for use while on-the-go.

Design Resource: The System Design Primer

Looking for resources to help you prep for the System Design and Object-Oriented Design interviews?


Check out the sister repo The System Design Primer, which contains additional Anki decks:

Notebook Structure

Each challenge has two notebooks, a challenge notebook with unit tests for you to solve and a solution notebook for reference.

Problem Statement

  • States the problem to solve.

Constraints

  • Describes any constraints or assumptions.

Test Cases

  • Describes the general and edge test cases that will be evaluated in the unit test.

Algorithm

  • [Challenge Notebook] Empty, refer to the solution notebook algorithm section if you need a hint.
  • [Solution Notebook] One or more algorithm solution discussions, with Big-O time and space complexities.

Hints

  • [Challenge Notebook] Provides on-demand incremental hints to help you arrive at the optimal solution. Coming soon!

Code (Challenge: Implement Me!)

  • [Challenge Notebook] Skeleton code for you to implement.
  • [Solution Notebook] One or more reference solutions.

Unit Test

  • [Challenge Notebook] Unit test for your code. Expected to fail until you solve the challenge.
  • [Solution Notebook] Unit test for the reference solution(s).

Index

Challenges Categories

Format: Challenge Category - Number of Challenges

Total number of challenges: 120

Reference Implementations: Data Structures

Unit tested, fully functional implementations of the following data structures:

Reference Implementations: Algorithms

Unit tested, fully functional implementations of the following algorithms:

Reference Implementations: TODO

A

Installing and Running Challenges

Misc

Challenges

Image Credits



Arrays and Strings

Binder

| Challenge | Static Notebook | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Determine if a string contains unique characters | Challenge โ”‚ Solution | | Determine if a string is a permutation of another | Challenge โ”‚ Solution | | Determine if a string is a rotation of another | Challenge โ”‚ Solution | | Compress a string | Challenge โ”‚ Solution | | Reverse characters in a string | Challenge โ”‚ Solution | | Given two strings, find the single different char | Challenge โ”‚ Solution | | Find two indices that sum to a specific value | Challenge โ”‚ Solution | | Implement a hash table | Challenge โ”‚ Solution | | Implement fizz buzz | Challenge โ”‚ Solution | | Find the first non-repeated character in a string | Contribute โ”‚ Contribute | | Remove specified characters in a string | Contribute โ”‚ Contribute | | Reverse words in a string | Contribute โ”‚ Contribute | | Convert a string to an integer | Contribute โ”‚ Contribute | | Convert an integer to a string | Contribute โ”‚ Contribute | | Add a challenge | Contribute โ”‚ Contribute |



Linked Lists

Binder

| Challenge | Static Notebook | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Remove duplicates from a linked list | Challenge โ”‚ Solution | | Find the kth to last element of a linked list | Challenge โ”‚ Solution | | Delete a node in the middle of a linked list | Challenge โ”‚ Solution | | Partition a linked list around a given value | Challenge โ”‚ Solution | | Add two numbers whose digits are stored in a linked list | Challenge โ”‚ Solution | | Find the start of a linked list loop | Challenge โ”‚ Solution | | Determine if a linked list is a palindrome | Challenge โ”‚ Solution | | Implement a linked list | Challenge โ”‚ Solution | | Determine if a list is cyclic or acyclic | Contribute โ”‚ Contribute | | Add a challenge | Contribute โ”‚ Contribute |



Stacks and Queues

Binder

| Challenge | Static Notebook | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Implement n stacks using a single array | Challenge โ”‚ Solution | | Implement a stack that keeps track of its minimum element | Challenge โ”‚ Solution | | Implement a set of stacks class that wraps a list of capacity-bounded stacks | Challenge โ”‚ Solution | | Implement a queue using two stacks | Challenge โ”‚ Solution | | Sort a stack using another stack as a buffer | Challenge โ”‚ Solution | | Implement a stack | Challenge โ”‚ Solution | | Implement a queue | Challenge โ”‚ Solution | | Implement a priority queue backed by an array | Challenge โ”‚ Solution | | Add a challenge | Contribute โ”‚ Contribute |



Graphs and Trees

Binder

| Challenge | Static Notebooks | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Implement depth-first search (pre-, in-, post-order) on a tree | Challenge โ”‚ Solution | | Implement breadth-first search on a tree | Challenge โ”‚ Solution | | Determine the height of a tree | Challenge โ”‚ Solution | | Create a binary search tree with minimal height from a sorted array | Challenge โ”‚ Solution | | Create a linked list for each level of a binary tree | Challenge โ”‚ Solution | | Check if a binary tree is balanced | Challenge โ”‚ Solution | | Determine if a tree is a valid binary search tree | Challenge โ”‚ Solution | | Find the in-order successor of a given node in a binary search tree | Challenge โ”‚ Solution | | Find the second largest node in a binary search tree | Challenge โ”‚ Solution | | Find the lowest common ancestor | Challenge โ”‚ Solution | | Invert a binary tree | Challenge โ”‚ Solution | | Implement a binary search tree | Challenge โ”‚ Solution | | Implement a min heap | Challenge โ”‚ Solution | | Implement a trie | Challenge โ”‚ Solution | | Implement depth-first search on a graph | Challenge โ”‚ Solution | | Implement breadth-first search on a graph | Challenge โ”‚ Solution | | Determine if there is a path between two nodes in a graph | Challenge โ”‚ Solution | | Implement a graph | Challenge โ”‚ Solution | | Find a build order given a list of projects and dependencies. | Challenge โ”‚ Solution | | Find the shortest path in a weighted graph. | Challenge โ”‚ Solution | | Find the shortest path in an unweighted graph. | Challenge โ”‚ Solution | | Add a challenge | Contribute โ”‚ Contribute |



Sorting

Binder

| Challenge | Static Notebooks | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Implement selection sort | Challenge โ”‚ Solution | | Implement insertion sort | Challenge โ”‚ Solution | | Implement quick sort | Challenge โ”‚ Solution | | Implement merge sort | Challenge โ”‚ Solution | | Implement radix sort | Challenge โ”‚ Solution | | Sort an array of strings so all anagrams are next to each other | Challenge โ”‚ Solution | | Find an item in a sorted, rotated array | Challenge โ”‚ Solution | | Search a sorted matrix for an item | Challenge โ”‚ Solution | | Find an int not in an input of n integers | Challenge โ”‚ Solution | | Given sorted arrays A, B, merge B into A in sorted order | Challenge โ”‚ Solution | | Implement a stable selection sort | Contribute โ”‚ Contribute | | Make an unstable sort stable | Contribute โ”‚ Contribute | | Implement an efficient, in-place version of quicksort | Contribute โ”‚ Contribute | | Given two sorted arrays, merge one into the other in sorted order | Contribute โ”‚ Contribute | | Find an element in a rotated and sorted array of integers | Contribute โ”‚ Contribute | | Add a challenge | Contribute โ”‚ Contribute |



Recursion and Dynamic Programming

Binder

| Challenge | Static Notebooks | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Implement fibonacci recursively, dynamically, and iteratively | Challenge โ”‚ Solution | | Maximize items placed in a knapsack | Challenge โ”‚ Solution | | Maximize unbounded items placed in a knapsack | Challenge โ”‚ Solution | | Find the longest common subsequence | Challenge โ”‚ Solution | | Find the longest increasing subsequence | Challenge โ”‚ Solution | | Minimize the cost of matrix multiplication | Challenge โ”‚ Solution | | Maximize stock prices given k transactions | Challenge โ”‚ Solution | | Find the minimum number of ways to represent n cents given an array of coins | Challenge โ”‚ Solution | | Find the unique number of ways to represent n cents given an array of coins | Challenge โ”‚ Solution | | Print all valid combinations of n-pairs of parentheses | Challenge โ”‚ Solution | | Navigate a maze | Challenge โ”‚ Solution | | Print all subsets of a set | Challenge โ”‚ Solution | | Print all permutations of a string | Challenge โ”‚ Solution | | Find the magic index in an array | Challenge โ”‚ Solution | | Find the number of ways to run up n steps | Challenge โ”‚ Solution | | Implement the Towers of Hanoi with 3 towers and N disks | Challenge โ”‚ Solution | | Implement factorial recursively, dynamically, and iteratively | Contribute โ”‚ Contribute | | Perform a binary search on a sorted array of integers | Contribute โ”‚ Contribute | | Print all combinations of a string | Contribute โ”‚ Contribute | | Implement a paint fill function | Contribute โ”‚ Contribute | | Find all permutations to represent n cents, given 1, 5, 10, 25 cent coins | Contribute โ”‚ Contribute | | Add a challenge | Contribute โ”‚ Contribute |



Mathematics and Probability

Binder

| Challenge | Static Notebooks | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Generate a list of primes | Challenge โ”‚ Solution | | Find the digital root | Challenge โ”‚ Solution | | Create a class supporting insert, max, min, mean, mode in O(1) | Challenge โ”‚ Solution | | Determine if a number is a power of two | Challenge โ”‚ Solution | | Add two numbers without the + or - sign | Challenge โ”‚ Solution | | Subtract two numbers without the + or - sign | Challenge โ”‚ Solution | | Check if a number is prime | Contribute โ”‚ Contribute | | Determine if two lines on a Cartesian plane intersect | Contribute โ”‚ Contribute | | Using only add, implement multiply, subtract, and divide for ints | Contribute โ”‚ Contribute | | Find the kth number such that the only prime factors are 3, 5, and 7 | Contribute โ”‚ Contribute | | Add a challenge | Contribute โ”‚ Contribute |



Bit Manipulation

Binder

| Challenge | Static Notebooks | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Implement common bit manipulation operations | Challenge โ”‚ Solution | | Determine number of bits to flip to convert a into b | Challenge โ”‚ Solution | | Draw a line on a screen | Challenge โ”‚ Solution | | Flip a bit to maximize the longest sequence of 1s | Challenge โ”‚ Solution | | Get the next largest and next smallest numbers | Challenge โ”‚ Solution | | Merge two binary numbers | Challenge โ”‚ Solution | | Swap odd and even bits in an integer | Challenge โ”‚ Solution | | Print the binary representation of a number between 0 and 1 | Challenge โ”‚ Solution | | Determine the number of 1s in the binary representation of a given integer | Contribute โ”‚ Contribute | | Add a challenge | Contribute โ”‚ Contribute |



Online Judges

Binder

| Challenge | Static Notebooks | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| | Find the longest substring with at most k distinct chars | Challenge โ”‚ Solution | | Find the highest product of three numbers | Challenge โ”‚ Solution | | Maximize stocks profit from 1 buy and 1 sell | Challenge โ”‚ Solution | | Move all zeroes in a list to the end | Challenge โ”‚ Solution | | Find the products of every other int | Challenge โ”‚ Solution | | Given a list of entries and exits, find the busiest period | Challenge โ”‚ Solution | | Determine an island's perimeter | Challenge โ”‚ Solution | | Format license keys | Challenge โ”‚ Solution | | Find the longest absolute file path | Challenge โ”‚ Solution | | Merge tuple ranges | Challenge โ”‚ Solution | | Assign cookies | Challenge โ”‚ Solution | | Determine if you can win in Nim | Challenge โ”‚ Solution | | Check if a magazine could have been used to create a ransom note | Challenge โ”‚ Solution | | Find the number of times a sentence can fit on a screen | Challenge โ”‚ Solution | | Utopian tree | Challenge โ”‚ Solution | | Maximizing xor | Challenge โ”‚ Solution

ยฉ 2026 GitRepoTrend ยท donnemartin/interactive-coding-challenges ยท Updated daily from GitHub