Fibonacci(n)
Return the nth Fibonacci number efficiently.
Find all anagrams
Return all starting indices where any anagram of a given word appears as a substring.
Substring Anagrams
Return all start indices in a string where a substring of length k is an anagram of a pattern string.
Longest Palindrome Substring
Given a string s, return the longest substring that reads the same forwards and backwards.
Merge intervals
Merge all overlapping intervals and return a sorted result.
Product except self
Return an array where output[i] is the product of all elements except nums[i], without using division.
Product of All Except Zeros Handling
Given a list of integers, return a list where each element is the product of all other elements, handling zeros correctly.
Partition around a pivot value
Implement an in-place partition of a list around a given pivot value, returning the boundary index.
Function composition
Return a function that applies f after g: compose(f, g)(x) == f(g(x)).
Quicksort
Implement quicksort and return a sorted list.
BFS level-order traversal
Return the level-order traversal of a binary tree as a list of lists.
Graph DFS
Return all nodes reachable from a start node via DFS.
Find Peak Element
Implement a function that returns the index of any peak element in an integer array.
Merge Sort
Implement merge_sort(numbers) that returns a sorted copy of the input list using the merge sort algorithm.
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.
Memoize with TTL
Implement a decorator that caches function results for a limited time, returning cached values within the TTL and recomputing after expiry.
Bitwise AND of a Range
Given a range [a, b], return the bitwise AND of all integers in that inclusive range without iterating over all numbers.
Kadane Variant: Maximum Product Subarray
Implement max_product_subarray(nums) that returns the maximum product of any contiguous subarray.
Perfect Squares Sum
Given a positive integer n, return the least number of perfect squares (e.g., 1, 4, 9, 16, ...) that sum to n.
Longest Arithmetic Subsequence
Given a list of integers, return the length of the longest arithmetic subsequence (constant difference) within it.
Binary tree left side view
Given a binary tree, return the leftmost node's value at each depth, from top to bottom.
Delete Node in BST
Implement a function that deletes a key from a binary search tree and returns the new root.
Articulation Points
Implement a function that returns the articulation points of an undirected graph.
Bridges in Graph
Implement a function that returns all bridges in an undirected graph.
Course Schedule Can Finish
Given numCourses and prerequisites, return whether all courses can be finished without cyclic dependencies.
All Paths from Source to Target
Given a directed acyclic graph, return all paths from node 0 to the last node.
Combination Generator
Write a recursive function that returns all combinations of length k from a list of distinct integers.
Top K Frequent Elements
Given an integer array and a number k, return the k most frequent elements using a heap-based approach.
Spiral Matrix Order
Given a 2D matrix, return all elements in clockwise spiral order starting from the top-left.
01 Matrix Nearest Zero
Given a binary matrix, return a matrix of the same shape where each cell contains the Manhattan distance to the nearest 0.
Showing 31 challenges · medium
Guide: free Python coding challenges
Practice Python by solving problems
PythonSkillset challenges are hands-on coding exercises from beginner to advanced. Open a challenge, read the problem, write Python in the split-pane editor, and run tests with Pyodide — no install required.
How to use the arena
- Pick a category — basics, algorithms, strings, and more
- Open a challenge, read the statement, and edit the starter code
- Run tests, fix failures, then try a related quiz or tutorial lesson
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.