Insert into a Sorted List
Implement a function that inserts a value into a sorted list at the correct position using binary search.
Convert Binary Number List
Given a list of bits (0s and 1s) in most-significant-first order, return the equivalent integer value.
Binary search
Return the index of target in a sorted list, or -1 if not present.
BFS level-order traversal
Return the level-order traversal of a binary tree as a list of lists.
Longest increasing subsequence
Return the length of the longest strictly increasing subsequence.
Find Peak Element
Implement a function that returns the index of any peak element in an integer array.
Median of Two Sorted Arrays
Given two sorted arrays, return the median of the combined sorted array in O(log(min(n,m))) time.
Path Sum II All Paths
Return all root-to-leaf paths where the sum of node values equals a target.
Shortest Path in Binary Matrix
Implement BFS to find the shortest path length from (0,0) to (n-1,n-1) in an n x n binary matrix, moving through 0 cells in 8 directions.
K Closest Elements
Implement a function to return the k closest elements to a target in a sorted array.
Level Order Traversal
Implement a function that performs a level order traversal of a binary tree and returns node values as a list of lists.
Lowest Common Ancestor in a Binary Search Tree
Implement a function to find the lowest common ancestor of two node values in a binary search tree.
Largest Area Histogram Matrix
Given a binary matrix, compute the largest rectangle area consisting entirely of 1s.
Tree inorder generator
Write a generator function that yields a binary tree's node values in inorder traversal.
Integer Square Root Floor
Implement a function that returns the greatest integer whose square is ≤ n, using only integer operations.
Integer Square Root
Implement integer_sqrt(n) that returns the largest integer whose square is ≤ n.
Count Set Bits
Implement a function that returns the number of set bits (1s) in the binary representation of a non-negative integer.
Gray Code Decode
Implement gray_decode(n) that converts an n-bit Gray code integer back to its standard binary value using XOR accumulation.
Compress Bits Run
Write a function that compresses a binary string by representing consecutive identical bits as a count-bit pair.
Sparse Number Check
Check if a non-negative integer is sparse, meaning its binary representation contains no adjacent 1 bits.
Reverse Bits
Implement a function that reverses the bits of a given 32-bit unsigned integer.
Find Duplicate Bits
Given a positive integer, return the positions where the bit value appears more than once in its binary form.
Toggle kth Bit
Implement a function that toggles the kth bit of a non-negative integer (0-indexed from the least significant bit) and returns the new integer.
Maximal square
Given a 2D binary matrix of 0s and 1s, compute the area of the largest square containing only 1s.
Showing 1–24 of 82 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.