Radix Sort
Implement LSD radix sort to sort a list of non-negative integers in ascending order.
Bucket Sort
Implement bucket sort to sort a list of floating-point numbers in the range [0,1).
Shell Sort
Implement Shell sort, an in-place comparison sort that generalizes insertion sort, using a gap sequence that shrinks by half each pass.
Exponential Search
Implement exponential search to find any valid index of a target in a sorted list.
Decode Ways
Count the number of ways to decode a numeric string into letters using the mapping A=1 to Z=26.
Path Sum II All Paths
Return all root-to-leaf paths where the sum of node values equals a target.
Redundant Connection
Given a list of edges forming a tree plus one extra edge, return the edge that appears last in the input and creates a cycle.
Reconstruct Itinerary
Given a list of airline tickets, reconstruct the itinerary in order using each ticket exactly once, choosing the lexicographically smallest path when multiple options exist.
Shortest Path in Binary Matrix
Implement BFS to find the shortest path length from (0,0) to (n-1,n-1) in an n x n binary matrix, moving through 0 cells in 8 directions.
Find Peak Index
Given a list of integers, return the index of any peak element where the value is not smaller than its neighbors.
Peak Element in Array
Implement a function that returns the index of any peak element in a list of integers.
Count of Range Sum
Count contiguous subarrays whose sum lies in a given inclusive range using an efficient divide-and-conquer algorithm.
K Closest Elements
Implement a function to return the k closest elements to a target in a sorted array.
Next greater element II
For each element in a circular array, find the next greater element (NGE) to its right, wrapping around.
Largest Rectangle in Histogram
Given an array of bar heights, compute the largest rectangle that can be formed by consecutive bars.
Basic Calculator II
Evaluate a basic arithmetic expression with +, -, *, / following operator precedence.
Design Front Middle Back Queue
Implement a data structure that supports push/pop at front, middle, and back of a queue.
Online Stock Span
Implement StockSpanner.next(price) that returns the maximum number of consecutive days (including today) with price <= current price.
Merge Two Sorted Lists
Write a function that merges two sorted lists into a single sorted list.
Trie Insert and Search
Implement a Trie and a scenario runner that executes insert/search/prefix operations.
Jump Search
Implement the jump search algorithm to locate a target in a sorted list, returning its index or -1.
Flood Fill Algorithm
Implement flood fill on a 2D grid using BFS/DFS.
Eulerian Path Check
Given the number of vertices and an edge list of an undirected graph, decide if it has an Eulerian path.
AST Visitor Lite
Implement a depth-first traversal of a simplified AST and return identifier names in order.
Showing 25–48 of 69 challenges · Data Structures & Algorithms
Data Structures & Algorithms — Python coding challenges
What you will find here
This page lists data structures & algorithms challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.
Challenges vs tutorials and quizzes
Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.