Fruit into Baskets
Given an array of integers representing fruit types, return the maximum number of fruits you can collect in a contiguous subarray with at most two distinct types.
Minimum Window Subsequence
Given strings s and t, return the minimum window substring of s that contains t as a subsequence, or empty string if none exists.
Boats to Save People – Two Pointer
Implement a function that returns the minimum number of boats needed to rescue everyone, given a weight limit and each boat carrying at most two people.
Sliding Window Median
Given a list of integers and a positive window size k, return the median of each sliding window of length k.
Longest Repeating Character Replacement
Given a string and an integer k, return the length of the longest substring that can be made of identical characters after at most k replacements.
Next Greater Element
Return a list where each position holds the next greater element to the right, or -1 if none exists.
Daily Temperatures
Given a list of daily temperatures, return for each day how many days until a warmer temperature appears.
Buildings with ocean view
Given building heights, return sorted indices of buildings that have a clear view of the ocean to their right.
Asteroid Collision
Simulate asteroid collisions with a stack and return the remaining asteroids in original order.
Top K Frequent Elements
Given an integer array and a number k, return the k most frequent elements using a heap-based approach.
Kth Largest Element in an Array (Heap Edition)
Implement a function that returns the kth largest element in an unsorted integer array using a heap.
Top K Frequent Elements
Given a list of integers and a number k, return the k most frequent elements in descending order of frequency, with ties broken by larger value.
Find K pairs with smallest sums
Given two sorted arrays and an integer k, return the k smallest pairs (u, v) with the smallest sums, sorted by sum.
Last Stone Weight
Given an array of stone weights, repeatedly smash the two heaviest stones and return the last remaining weight or 0.
Sliding Window Maximum using Heap
Given an array of integers and a window size k, return an array of maximums for each contiguous subarray of length k.
Count nodes in a linked list
Return how many values appear in the list (one per node).
Read the head node value
Return the first value or None when the list is empty.
Read the tail node value
Return the last value or None when the list is empty.
Reverse a linked list copy
Return a new list with node values in reverse order without mutating the input.
Concatenate two linked lists
Append the second list's nodes after the first and return a new list.
Value at index n
Return the value at zero-based index n or None if out of range.
Middle node index
Return the floor middle index for a non-empty list.
Maximum node value
Return the largest integer or None when empty.
Remove the head node
Return a new list without the first node.
Showing 289–312 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.