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.
Merge time intervals
Given a list of time intervals, merge all overlapping intervals and return the merged intervals.
Consecutive available seats
Given a list of seat statuses, return the length of the longest consecutive run of available (0) seats.
Delete duplicates sorted II
Given a sorted list, remove duplicates in place so each element appears at most twice, returning the new length.
Arithmetic Slices Count
Given a list of integers, count how many contiguous subarrays of length at least 3 form an arithmetic sequence.
Sieve of Eratosthenes
Implement the Sieve of Eratosthenes to return a sorted list of all primes up to a given integer n.
Correlation Coefficient
Write a pure-Python function that computes the Pearson correlation coefficient between two lists of numbers.
Single Number XOR
Given a non-empty list of integers where every element appears twice except one, return the single number using XOR.
Missing Number XOR
Given a list of n distinct numbers from 0 to n with one missing, use XOR to find and return the missing number.
Maximum XOR Pair
Implement max_xor_pair(nums) that returns the maximum XOR value obtainable by pairing any two numbers in the given list.
Kadane Variant: Maximum Product Subarray
Implement max_product_subarray(nums) that returns the maximum product of any contiguous subarray.
Max Profit from Selling Twice
Compute the maximum profit that can be achieved by completing at most two buy-sell transactions on a given price array.
Min cost climbing stairs
Compute the minimum total cost to reach the top of a staircase, given you can climb 1 or 2 steps at a time.
House Robber
Given a list of house values, return the maximum sum you can rob without robbing two adjacent houses.
House Robber Circular
Solve the House Robber problem with houses arranged in a circle.
Unique Paths with Obstacles
Given a 2D grid with obstacles, count the unique paths from top-left to bottom-right moving only down or right.
Triangle Minimum Path
Compute the minimum path sum from top to bottom of a triangle given as a list of lists.
Maximal square
Given a 2D binary matrix of 0s and 1s, compute the area of the largest square containing only 1s.
Paint House Colors
Given a cost matrix, compute the minimum total cost to paint all houses with no two adjacent houses having the same color.
Create Maximum Number
Given two arrays of digits and an integer k, merge them to form the largest number of length k.
Shortest Unsorted Continuous Subarray
Given an array of integers, return the length of the shortest contiguous subarray whose sorting makes the whole array sorted.
Maximal square matrix
Given a 2D binary matrix of 0s and 1s, find the side length of the largest square containing only 1s.
Showing 49–72 of 170 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.