Set symmetric difference
Write a function that returns the elements found in exactly one of two sets, sorted ascending.
Anagram check
Return True if two strings are anagrams of each other.
Sort characters alphabetically
Sort all characters in a string alphabetically and return the sorted string.
Sort characters in string
Write a function that sorts the characters in a string and returns the sorted string.
Remove duplicates (sorted)
Return a sorted list with duplicates removed.
Merge two sorted arrays
Merge two sorted arrays into one sorted array.
Merge intervals
Merge all overlapping intervals and return a sorted result.
Second Largest Unique Value
Return the second largest distinct integer from a list, or None if it doesn't exist.
Insert into a Sorted List
Implement a function that inserts a value into a sorted list at the correct position using binary search.
Average excluding min and max
Return the average of a list after discarding the lowest and highest elements, handling edge cases.
Find Second Largest
Find the second largest unique number in a list, or None if it doesn't exist.
Move Zeros to End
Rearrange a list by moving all zeros to the end while preserving the relative order of non-zero elements.
Intersection of Two Lists
Given two lists, return a sorted list of unique elements that appear in both lists.
Wave sort array
Given a list of integers, reorder it into a wave pattern where elements alternate down-up, and return the new list.
Counting Sort
Implement the counting sort algorithm to sort a list of non-negative integers in O(n + k) time.
List intersection
Return the sorted list of elements common to both lists.
Group anagrams
Group words that are anagrams of each other.
Keys Sorted by Value Descending
Given a dictionary mapping strings to integers, return a list of keys sorted by value descending, and when values tie, alphabetically ascending.
Anagram Dictionary Groups Lite
Group a list of words into anagrams using a dictionary keyed by sorted characters.
Common Keys of Two Dictionaries
Implement a function that finds keys shared by two dictionaries and returns them sorted.
Union of Many Sets
Implement a function that takes any number of sets and returns a sorted list of their union.
Top k keys by count
Given a dictionary mapping keys to counts, return the top k keys with the highest counts, breaking ties alphabetically.
Anagram Groups by Size
Group a list of words into anagram groups and return them sorted by group size and lexicographically.
Top K Frequent Words
Given a list of words, return the k most frequent words sorted by frequency (descending) and then alphabetically.
Sort by frequency
Sort a list by element frequency descending, with ties broken by order of first occurrence.
Symmetric Difference
Write a function that computes the symmetric difference of two lists, returning a sorted list of unique elements.
Frequency sort descending
Write a function that sorts a list by frequency descending while preserving original order for ties.
Binary search
Return the index of target in a sorted list, or -1 if not present.
Quicksort
Implement quicksort and return a sorted list.
Topological sort (Kahn)
Return a valid topological ordering of tasks, or [] if a cycle exists.
Count inversions lite
Implement a function that counts inversions in a list of numbers efficiently.
Longest Consecutive Sequence
Given an unsorted list of integers, find the length of the longest consecutive elements sequence in O(n) time.
Median of Two Sorted Arrays
Given two sorted arrays, return the median of the combined sorted array in O(log(min(n,m))) time.
Bubble Sort
Implement bubble sort that sorts a list of numbers in ascending order.
Selection Sort Implementation
Implement selection sort to sort a list of numbers in ascending order.
Merge Sort
Implement merge_sort(numbers) that returns a sorted copy of the input list using the merge sort algorithm.
Heap Sort Implementation
Implement the heap sort algorithm to sort a list of comparable elements in non-decreasing order.
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.
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.
Sieve of Eratosthenes
Implement the Sieve of Eratosthenes to return a sorted list of all primes up to a given integer n.
Prime Factorization
Return a sorted list of prime factors of a positive integer, including repeated factors.
Vertical Order Traversal
Compute the vertical order traversal of a binary tree, grouping nodes by column and row.
Alien Dictionary Order
Given a sorted list of words in an alien language, derive the order of its unique letters.
Search in Rotated Array
Implement an efficient search in a rotated sorted array using modified binary search.
Interpolation Search
Implement interpolation search in Python on a sorted list of integers.
Sort Colors (Dutch National Flag)
Implement the Dutch National Flag algorithm to sort an array of 0, 1, 2 in one pass.
Showing 49 challenges
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.