Count word occurrences
Write a function that takes a sentence and returns a dictionary of word counts.
Garbage Collection Hint
Write a function that predicts when an object is garbage collected based on reference counting.
Count Leading Zeros
Write a function that returns the number of leading zeros in a list of integers.
Count vowels
Count the number of vowels (a, e, i, o, u) in a string (case-insensitive).
Count words in a sentence
Implement a function to count words in a sentence, ignoring extra whitespace and handling empty strings.
Count consonants
Write a function that counts the number of consonant letters in a string.
Count Syllables (Simple)
Count syllables in a word by counting groups of consecutive vowels (a, e, i, o, u).
Count Substrings
Implement a function that counts non-overlapping occurrences of a substring in a given string.
Most Common Character
Return the character that appears most frequently in a string, breaking ties by earliest occurrence.
Majority Element Finder
Implement a function that returns the majority element in a list, which appears more than half the time.
Difference of Two Lists
Write a function that returns items in list a that are not in list b, preserving order and duplicates.
Counting Sort
Implement the counting sort algorithm to sort a list of non-negative integers in O(n + k) time.
Merge dicts summing values
Write a function that merges two dictionaries by summing values for duplicated keys.
Are two lists the same multiset
Write a function that checks if two lists contain the same elements with the same multiplicities, ignoring order.
Mode of a list via counting
Implement a function that returns the mode of a list, resolving ties by the element that appears first.
Values that appear once
Return a list of numbers that appear exactly once in the input list, in original order.
Pair with difference K
Count unordered index pairs with absolute difference exactly K, handling duplicates correctly.
Set intersection size
Count how many distinct values appear in both of two given lists.
Count Pairs with Sum
Implement a function that counts the number of distinct pairs in a list summing to a target.
Ransom Note Builder
Given two strings, determine if the ransom note can be formed from the words in the magazine.
Count inversions lite
Implement a function that counts inversions in a list of numbers efficiently.
Count pairs with given difference
Count how many unordered pairs in a list have a given absolute difference using an efficient approach.
Radix Sort
Implement LSD radix sort to sort a list of non-negative integers in ascending order.
Decode Ways
Count the number of ways to decode a numeric string into letters using the mapping A=1 to Z=26.
Power set size
Compute the size of the power set of a given sequence.
Count divisors
Compute the number of positive divisors of a given integer using its prime factorization.
Count Set Bits
Implement a function that returns the number of set bits (1s) in the binary representation of a non-negative integer.
Brian Kernighan count
Implement a function that counts set bits using Brian Kernighan's efficient algorithm.
Climbing Stairs
Implement a function that returns the number of distinct ways to climb n stairs using steps of 1 or 2.
Unique Paths in a Grid
Count the number of unique paths from the top-left corner to the bottom-right corner of a grid, moving only right and down.
Target Sum Subsets
Write a function that counts the number of subsets of a list of positive integers that sum exactly to a target.
Coin Change Ways
Count the number of distinct combinations of coins that sum to a target amount.
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.
Top K Frequent Elements
Given an integer array and a number k, return the k most frequent elements using a heap-based approach.
Showing 35 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.