Convert Binary Number List
Given a list of bits (0s and 1s) in most-significant-first order, return the equivalent integer value.
Flatten Multidimensional Lists
Write a function that flattens arbitrarily nested lists of integers into a single list.
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 Harmonious Subsequence
Given a list of integers, find the length of the longest harmonious subsequence where the difference between maximum and minimum values is exactly 1.
Index of peak element
Implement a function that returns the index of any peak element in a given integer array.
Find Peak Element
Implement a function that returns the index of any peak element in an integer array.
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.
Find Peak Index
Given a list of integers, return the index of any peak element where the value is not smaller than its neighbors.
Peak Element in Array
Implement a function that returns the index of any peak element in a list of integers.
Argsort Indices
Implement a function that returns the indices that would sort a list of integers, with ties broken by original order.
Arithmetic Slices Count
Given a list of integers, count how many contiguous subarrays of length at least 3 form an arithmetic sequence.
Strobogrammatic number II
Given a positive integer n, return all strobogrammatic numbers of length n in ascending order.
Descriptor Property
Create a descriptor class that ensures attribute values are positive integers.
Collatz Generator
Implement a generator function that yields the Collatz sequence starting from a given positive integer.
Digit Expansion Generator
Create a generator that lazily yields each decimal digit of a non-negative integer from most significant to least significant.
Flatten Nested List Iterator
Implement a class that iterates over all integers in a nested list structure in depth-first order.
Safe Integer from String
Implement safe_int that converts a string to an integer, returning a default value on any failure, with support for an optional base.
Parse Error Recovery
Parse a whitespace-separated string into a list of valid integers, skipping invalid tokens.
Nth Triangular Number
Implement a function that returns the nth triangular number efficiently.
Integer Square Root Floor
Implement a function that returns the greatest integer whose square is ≤ n, using only integer operations.
Euler Totient Function
Implement Euler's totient function φ(n) for positive integers.
Sieve of Eratosthenes
Implement the Sieve of Eratosthenes to return a sorted list of all primes up to a given integer n.
Showing 49–72 of 163 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.