GCD via Euclid
Compute the greatest common divisor of two positive integers.
Absolute Difference of Two Integers
Compute the absolute difference between two integers, regardless of order.
Grade from Score
Write a function that maps a numeric score to its letter grade using standard grading thresholds.
Min of three numbers
Write a function that returns the minimum of three integers.
Integer division and remainder
Write a function that performs integer division and returns both quotient and remainder.
Sum numbers from 1 to n
Implement a function that computes the sum of all integers from 1 to n.
Seconds to Hours Minutes Seconds
Convert total seconds into a zero-padded HH:MM:SS format.
Digit count of an integer
Given an integer, return the number of digits it has, handling negatives and zero correctly.
Count Multiples in a Range
Given a start, end, and divisor, count how many integers in [start, end] are divisible by the divisor.
Sum from 1 to n
Write a function that returns the sum of all integers from 1 to n (inclusive).
Count Positives
Count the positive numbers in a list of integers.
Round to nearest ten
Write a function that rounds any integer to the nearest multiple of ten.
Modulo Remainder
Implement a function that returns the remainder of a divided by b without using the modulo operator.
Last Digit Extractor
Write a function that returns the last digit of a non-negative integer using the modulo operator.
Find Missing Number
Given a list of n distinct integers from 0..n with one missing, return the missing number.
Map, Filter, Reduce
Implement three functions using map, filter, and reduce to manipulate a list of integers.
Count trailing zeros
Write a function that counts the number of trailing zeros in the decimal representation of a positive integer.
Count Leading Zeros
Write a function that returns the number of leading zeros in a list of integers.
Find all numbers in text
Write a function that extracts all standalone integers from a text string using regular expressions.
Running Product of Integers
Given a list of integers, return a new list where each element at index i is the product of all elements from index 0 to i.
Find Missing Number 1 to n
Given a list containing n-1 distinct integers from 1 to n, find the missing number without using extra space.
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.
Find Duplicate Number
Given a list of n+1 integers in the range 1..n, find the one integer that appears more than once.
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.
Two Missing Numbers
Given a list of n-2 unique integers from 1 to n, find the two missing numbers efficiently.
Three Missing Numbers
Find the three missing numbers from a shuffled list containing all but three integers from 1 to n.
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.
Longest Consecutive Sequence
Given an unsorted list of integers, find the length of the longest consecutive elements sequence in O(n) time.
Pascal Triangle Row
Given a non-negative integer n, return the nth row of Pascal's triangle as a list of integers.
Radix Sort
Implement LSD radix sort to sort a list of non-negative integers in ascending order.
Digit Expansion Generator
Create a generator that lazily yields each decimal digit of a non-negative integer from most significant to least significant.
Nth Triangular Number
Implement a function that returns the nth triangular number efficiently.
Euler Totient Function
Implement Euler's totient function φ(n) for positive integers.
Partition function
Write a function that returns the number of ways to write a positive integer as a sum of positive integers (order irrelevant).
Multiply without multiply
Write a function that multiplies two integers using only addition, subtraction, and bit shifts — no * operator.
Single Number XOR
Given a non-empty list of integers where every element appears twice except one, return the single number using XOR.
Gray Code Decode
Implement gray_decode(n) that converts an n-bit Gray code integer back to its standard binary value using XOR accumulation.
Bitwise AND of a Range
Given a range [a, b], return the bitwise AND of all integers in that inclusive range without iterating over all numbers.
Add without plus
Implement a function that adds two integers using only bitwise operations, no arithmetic plus or minus.
Divide using shifts
Implement division of two integers using only bit shifts and arithmetic, without using division or modulo operators.
Brian Kernighan count
Implement a function that counts set bits using Brian Kernighan's efficient algorithm.
Partition Equal Subset
Determine whether a given list of positive integers can be partitioned into two subsets with equal sum.
Target Sum Subsets
Write a function that counts the number of subsets of a list of positive integers that sum exactly to a target.
Integer Break Product
Given a positive integer n, break it into at least two positive integers that sum to n and maximize their product.
Longest Arithmetic Subsequence
Given a list of integers, return the length of the longest arithmetic subsequence (constant difference) within it.
Permutation Generator
Write a function that returns all permutations of a list of distinct integers.
Combination Generator
Write a recursive function that returns all combinations of length k from a list of distinct integers.
Interpolation Search
Implement interpolation search in Python on a sorted list of integers.
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.
Showing 52 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.