Set symmetric difference
Write a function that returns the elements found in exactly one of two sets, sorted ascending.
Remove Duplicates from Sorted Array
Given a sorted list, remove duplicates in-place and return the new length.
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.
Insert into a Sorted List
Implement a function that inserts a value into a sorted list at the correct position using binary search.
Intersection of Two Lists
Given two lists, return a sorted list of unique elements that appear in both lists.
Merge Sorted Array In Place
Write a function that merges two sorted arrays into the first array in-place, keeping the result sorted.
Cartesian Product Pairs
Create a function that returns the Cartesian product of two lists as a sorted list of lists.
List intersection
Return the sorted list of elements common to both lists.
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.
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.
Symmetric Difference
Write a function that computes the symmetric difference of two lists, returning a sorted list of unique elements.
Binary search
Return the index of target in a sorted list, or -1 if not present.
Quicksort
Implement quicksort and return a sorted list.
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.
Merge Sort
Implement merge_sort(numbers) that returns a sorted copy of the input list using the merge sort algorithm.
Exponential Search
Implement exponential search to find any valid index of a target in a sorted list.
K Closest Elements
Implement a function to return the k closest elements to a target in a sorted array.
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.
Shortest Unsorted Continuous Subarray
Given an array of integers, return the length of the shortest contiguous subarray whose sorting makes the whole array sorted.
Alien Dictionary Order
Given a sorted list of words in an alien language, derive the order of its unique letters.
Patching Array
Given a sorted array of positive integers and a target n, find the minimum number of patches to make every number from 1 to n representable as a subset sum.
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.
Search Insert Position
Return the index where a target should be inserted into a sorted list to maintain order.
Find Minimum in Rotated Sorted Array
Implement a function that finds the minimum element in a rotated sorted array of distinct integers in O(log n) time.
Median of Sorted Array BS
Implement a binary search algorithm to find the median of two sorted arrays efficiently.
Single Element in Sorted Array
Given a sorted array where every element appears exactly twice except one which appears once, return the single element.
Upper Bound Binary Search
Write a function that returns the index of the first element greater than a target in a sorted list.
Find Indices of Target in Sorted List
Given a sorted list and a target, return the indices of its first and last occurrence, or [-1, -1] if absent.
Rotated Array Search II
Implement a function to search for a target in a rotated sorted array with possible duplicates.
Kth Smallest in Sorted Matrix
Implement kth_smallest(matrix, k) to return the kth smallest element in a row- and column-sorted square matrix.
Two Sum Sorted
Given a 1-indexed sorted array and a target, return the two indices that add up to the target.
Squares of Sorted Array
Implement a function that returns a sorted list of squares for a given non-decreasing integer array.
Interval List Intersections
Given two lists of sorted, disjoint intervals, return the list of intersections between them.
Buildings with ocean view
Given building heights, return sorted indices of buildings that have a clear view of the ocean to their right.
Kth Largest Element in an Array (Heap Edition)
Implement a function that returns the kth largest element in an unsorted integer array using a heap.
Find K pairs with smallest sums
Given two sorted arrays and an integer k, return the k smallest pairs (u, v) with the smallest sums, sorted by sum.
Showing 47 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.