Capacity to Ship Packages
Given package weights and days allowed, compute the smallest ship capacity that can deliver all packages in order within the given days.
Maximum Running Time of n Computers
Use binary search to maximize the running time for n computers with batteries.
Rotated Array Search II
Implement a function to search for a target in a rotated sorted array with possible duplicates.
Search 2D Matrix
Given a sorted 2D matrix with sorted rows and first element of each row greater than last of previous, find target efficiently.
Container With Most Water
Given an array of heights, find the maximum area between two vertical lines that can hold water.
Longest Substring Without Repeating Characters
Implement a function that returns the length of the longest substring without repeating characters.
Subarrays with K different ints
Count the number of contiguous subarrays that contain exactly K distinct integers.
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.
Longest Substring with At Most K Distinct Characters
Given a string and an integer k, find the length of the longest substring that contains at most k distinct characters.
Container With Most Water
Compute the maximum area between two vertical lines in an array of heights.
Max Stack Design
Implement a MaxStack class with push, pop, top, and get_max operations.
Decode String Stack
Decode a compressed string with repeated substrings like '3[a2[c]]' to 'accaccacc' using a stack-based approach.
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.
Decode Nested String
Implement a function that decodes a string with nested encoding patterns.
Min Heap Class
Build a MinHeap class with push, pop, peek, and size methods that maintain a valid min-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.
Task Scheduler Heap
Given a list of tasks and a cooldown, find the minimum number of CPU intervals needed to schedule all tasks without violating the cooldown.
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.
Meeting Rooms II with Heaps
Given a list of meeting intervals, compute the minimum number of rooms required using a heap-based approach.
Minimum Cost to Connect Sticks
Compute the minimum total cost to connect all sticks into one stick by repeatedly combining two sticks with the smallest lengths.
Reverse a linked list copy
Return a new list with node values in reverse order without mutating the input.
Showing 145–168 of 191 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.