Fibonacci(n)
Return the nth Fibonacci number efficiently.
Longest Substring with K Repeating Characters
Return the length of the longest substring of a given string in which every character appears at least K times.
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.
Change directory manager
Implement a function that processes `cd` commands and returns the resulting absolute path.
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.
Count Smaller Numbers
Given an integer list, return for each position how many later elements are smaller than it.
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.
K Closest Elements
Implement a function to return the k closest elements to a target in a sorted array.
Online Stock Span
Implement StockSpanner.next(price) that returns the maximum number of consecutive days (including today) with price <= current price.
AST Visitor Lite
Implement a depth-first traversal of a simplified AST and return identifier names in order.
Merge time intervals
Given a list of time intervals, merge all overlapping intervals and return the merged intervals.
Top N per group
Implement top_n_per_group that returns the top N scores for each group from a list of (group, score) pairs.
Showing 1–24 of 96 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.