Sort array by parity
Given a list of integers, return a new list with all evens first and odds last, preserving original relative order.
Count Adjacent Pairs
Given a list of integers and a target, count adjacent pairs whose sum equals the target.
Sort List Merge Sort
Write a function that sorts a list of integers using the merge sort algorithm.
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.
Pascal Triangle Row
Given a non-negative integer n, return the nth row of Pascal's triangle as a list of integers.
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.
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.
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.
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.
Add without plus
Implement a function that adds two integers using only bitwise operations, no arithmetic plus or minus.
Brian Kernighan count
Implement a function that counts set bits using Brian Kernighan's efficient algorithm.
Clear Rightmost Set Bit
Write a function clear_rightmost_set_bit that accepts a non-negative integer and returns the integer with its rightmost set bit cleared.
Subset XOR sum
Given a list of integers, compute the bitwise XOR of each non-empty subset and return the sum of those XOR totals.
Shortest Unsorted Continuous Subarray
Given an array of integers, return the length of the shortest contiguous subarray whose sorting makes the whole array sorted.
Showing 25–48 of 50 challenges · easy
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.