Minimum Size Subarray Sum
Given an array of positive integers, return the minimal length of a contiguous subarray with sum at least target, or 0 if none exists.
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.
Binary Subarray with Sum
Given a binary list and a goal sum, count the number of subarrays that add up to that goal.
Subarray product less than K
Count contiguous subarrays where the product of all elements is strictly less than a target K.
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.
Container With Most Water
Compute the maximum area between two vertical lines in an array of heights.
Trapping Rain Water (Two Pointers)
Given an array of non-negative integers representing elevation heights, compute how much water can be trapped after rain.
Four Sum
Find all unique quadruplets in an array that sum to a given target.
Count Nice Subarrays
Count subarrays that contain exactly k odd numbers.
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.
Sum of Subarray Minimums
Given an integer array, sum the minimum of all contiguous subarrays modulo 10^9+7.
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.
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.
Toeplitz Matrix Check
Write a function is_toeplitz(matrix) that checks if a 2D list is a Toeplitz matrix, where all elements on the same diagonal from top-left to bottom-right are identical.
Diagonal Traverse Matrix
Implement a function that returns all elements of a matrix in diagonal zigzag order.
Shift 2D Grid
Implement a function to shift a 2D grid right by k positions, flattening the grid and wrapping elements.
Matrix Block Sum
Given a 2D matrix and a block size, compute the sum of each block centered at every cell.
Transpose Matrix In-Place
Implement a function that transposes a square matrix in-place and returns the transposed matrix.
Showing 121–144 of 170 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.