Partition to k subsets
Determine if an array of positive integers can be partitioned into k subsets of equal sum using backtracking.
Partition Equal Subset Sum (Backtracking)
Write a function that uses backtracking to decide if a list of positive integers can be partitioned into two subsets with equal sum.
Combination Sum
Given a list of distinct positive integers and a target, return all unique combinations that sum to the target.
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.
Jump Game Reachable
Given an array of non-negative integers where each element is the maximum jump length, determine if you can reach the last index.
Interpolation Search
Implement interpolation search in Python on a sorted list of integers.
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.
Nth Magical Number
Given three integers n, a, b, return the nth positive integer that is divisible by either a or b.
Trapping Rain Water
Given an array of non-negative integers representing an elevation map, compute how much water it can trap after raining.
Count Nice Subarrays
Given an array of integers, count the number of contiguous subarrays that contain exactly k odd numbers.
Subarrays with K different ints
Count the number of contiguous subarrays that contain exactly K distinct integers.
Reduce array to zero
Given an array of non-negative integers, each operation chooses two indices and subtracts 1 from each if both are positive. Return the minimum number of operations to reduce the array to all zeros, or -1 if impossible.
Three Sum
Given an array of integers, return all unique triplets that sum to zero.
Closest Three Sum
Given an array of integers and a target, return the sum of three numbers that is closest to the target.
Minimum Size Subarray Sum
Given an array of positive integers, return the minimal length of a contiguous subarray with sum at least target, or 0 if none exists.
Fruit into Baskets
Given an array of integers representing fruit types, return the maximum number of fruits you can collect in a contiguous subarray with at most two distinct types.
Trapping Rain Water (Two Pointers)
Given an array of non-negative integers representing elevation heights, compute how much water can be trapped after rain.
Sliding Window Median
Given a list of integers and a positive window size k, return the median of each sliding window of length k.
Validate Stack Sequences
Given two sequences of distinct integers, verify whether the second sequence is a valid pop order for a stack given the first sequence as push order.
Top K Frequent Elements
Given a list of integers and a number k, return the k most frequent elements in descending order of frequency, with ties broken by larger value.
Sliding Window Maximum using Heap
Given an array of integers and a window size k, return an array of maximums for each contiguous subarray of length k.
Showing 73–93 of 93 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.