Change directory manager
Implement a function that processes `cd` commands and returns the resulting absolute path.
Find Peak Element
Implement a function that returns the index of any peak element in an integer array.
Merge Sort
Implement merge_sort(numbers) that returns a sorted copy of the input list using the merge sort algorithm.
Online Stock Span
Implement StockSpanner.next(price) that returns the maximum number of consecutive days (including today) with price <= current price.
Top N per group
Implement top_n_per_group that returns the top N scores for each group from a list of (group, score) pairs.
Level Order Traversal
Implement a function that performs a level order traversal of a binary tree and returns node values as a list of lists.
Zeller Congruence Weekday
Implement a function that returns the weekday name for a given date using Zeller's congruence.
Polynomial Fit Coefficients
Implement a function that returns the coefficients of the best-fit quadratic polynomial for given points.
Maximum XOR Pair
Implement max_xor_pair(nums) that returns the maximum XOR value obtainable by pairing any two numbers in the given list.
Kadane Variant: Maximum Product Subarray
Implement max_product_subarray(nums) that returns the maximum product of any contiguous subarray.
Delete Node in BST
Implement a function that deletes a key from a binary search tree and returns the new root.
Kth Smallest in BST
Implement a function that returns the k-th smallest value in a binary search tree.
Zigzag Level Order Traversal
Implement a function that returns the zigzag level-order traversal of a binary tree.
Articulation Points
Implement a function that returns the articulation points of an undirected graph.
Bridges in Graph
Implement a function that returns all bridges in an undirected graph.
Combination Generator
Write a recursive function that returns all combinations of length k from a list of distinct integers.
Book Allocation: Minimize Maximum Pages
Implement a function that returns the minimized maximum pages when allocating a list of books to k students.
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.
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.
Spiral Matrix Traversal
Implement a function that returns the elements of a 2D matrix in clockwise spiral order.
Easter Date Calculator
Implement a function that returns the date of Easter Sunday for a given year using the Gregorian computus algorithm.
Showing 1–21 of 21 challenges · medium
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.