Profile time decorator
Create a decorator that tracks how many times a function is called and its cumulative execution time.
Timer Context Manager
Implement a context manager that measures execution time of a with block and stores it.
Context Decorator Dual
Implement a timing decorator and a context manager that both record elapsed time in seconds.
Count calls decorator
Implement a decorator that counts and reports how many times the wrapped function is called.
Min cost climbing stairs
Compute the minimum total cost to reach the top of a staircase, given you can climb 1 or 2 steps at a time.
Count Complete Tree Nodes
Given a complete binary tree, return its node count faster than O(n) time.
Network Delay Time
Given a directed weighted graph and a starting node, find the minimum time for a signal to reach all nodes, or -1 if unreachable.
Find center of star graph
Write a function that finds the center node of a star graph from its list of edges in O(1) time.
Swim in Rising Water
Find the minimum time needed to swim from the top-left to the bottom-right of a grid where water level rises and you can only move to cells with elevation ≤ current time.
Meeting Rooms Minimum
Given a list of meeting time intervals, compute the minimum number of conference rooms required.
Max events attended
Given a list of events with start and end times, find the maximum number of non-overlapping events you can attend.
Find Minimum in Rotated Sorted Array
Implement a function that finds the minimum element in a rotated sorted array of distinct integers in O(log n) time.
Maximum Running Time of n Computers
Use binary search to maximize the running time for n computers with batteries.
Minimum Speed to Arrive on Time
Given commute distances and a time limit, compute the minimum integer speed so you arrive on time.
Best Time to Buy and Sell Stock
Given a list of daily stock prices, determine the maximum profit achievable by buying on one day and selling on a later day.
Count nodes equal to target
Count how many times target appears in the list.
Rotting Oranges Time
Given a grid of fresh, rotten, and empty cells, compute the minimum minutes until all fresh oranges rot, or -1 if some are unreachable.
Days in month
Write a function that returns the number of days in a given month and year, correctly handling leap years.
Format date output
Parse ISO date strings and format them into a friendly US-style date output.
Days Between Dates
Write a function that returns the number of days between two given dates.
Add Days to Date
Given a date in YYYY-MM-DD format and an integer number of days, return the resulting date in the same format.
Weekday from date
Write a function that returns the full English weekday name for a date string.
Leap Years in Range
Write a function that returns a list of all leap years between two given years, inclusive.
Age in years months days
Given birth and reference dates, return age as a dictionary with years, months, days.
Showing 25–48 of 67 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.