Find Rightmost Set Bit
Implement a function that returns the 1-indexed position of the rightmost set bit of a positive integer, or 0 if none.
Isolate Rightmost Set Bit
Given an integer, return a number with only its rightmost set bit set.
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.
Set kth Bit
Implement a function that sets the kth bit (0-indexed) of a non-negative integer to 1 and returns the result.
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.
Maximum XOR Pair
Implement max_xor_pair(nums) that returns the maximum XOR value obtainable by pairing any two numbers in the given list.
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.
Odd Parity Bit
Given an integer, return the odd parity bit (0 or 1) so that total number of 1-bits in the 8-bit representation becomes odd.
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.
Even Parity Bit
Given an integer, return the even parity bit (0 or 1) that makes the total count of set bits even.
Kadane Variant: Maximum Product Subarray
Implement max_product_subarray(nums) that returns the maximum product of any contiguous subarray.
Climbing Stairs
Implement a function that returns the number of distinct ways to climb n stairs using steps of 1 or 2.
House Robber
Given a list of house values, return the maximum sum you can rob without robbing two adjacent houses.
Perfect Squares Sum
Given a positive integer n, return the least number of perfect squares (e.g., 1, 4, 9, 16, ...) that sum to n.
Palindrome Partitioning Minimum Cuts
Given a string, return the minimum number of cuts needed such that every substring in the partition is a palindrome.
Longest Arithmetic Subsequence
Given a list of integers, return the length of the longest arithmetic subsequence (constant difference) within it.
Shortest Unsorted Continuous Subarray
Given an array of integers, return the length of the shortest contiguous subarray whose sorting makes the whole array sorted.
Ugly Number II
Given an integer n, return the nth ugly number using an efficient dynamic programming approach.
Shortest Common Supersequence
Given two strings, return any shortest supersequence that contains both as subsequences.
Subset Sum Exists
Given a list of positive integers and a target sum, return whether some subset adds up exactly to the target.
Binary Tree Inorder Traversal
Implement an inorder traversal function that returns node values in left-root-right order.
Preorder Traversal
Implement a function that returns the preorder traversal values of a binary tree.
Postorder Traversal
Implement a function that returns the postorder traversal of a binary tree as a list of node values.
Showing 217–240 of 371 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.