Maximum depth of tree
Implement max_depth(root) to return the maximum depth of a binary tree.
Binary tree left side view
Given a binary tree, return the leftmost node's value at each depth, from top to bottom.
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.
Range Sum BST
Return the sum of all node values in a BST that lie within a given inclusive range [low, high].
Count Complete Tree Nodes
Given a complete binary tree, return its node count faster than O(n) time.
Zigzag Level Order Traversal
Implement a function that returns the zigzag level-order traversal of a binary tree.
Dijkstra Shortest Path
Implement Dijkstra's algorithm on a weighted graph to return distances from a source to every node.
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.
Minimum Cut
Given an undirected graph in adjacency-list form, return the size of the minimum edge cut that disconnects the graph.
Course Schedule Can Finish
Given numCourses and prerequisites, return whether all courses can be finished without cyclic dependencies.
All Paths from Source to Target
Given a directed acyclic graph, return all paths from node 0 to the last node.
Find the Town Judge
Given n people and a trust array, return the town judge or -1.
Topological Sort via DFS
Return a deterministic topological ordering of nodes in a directed acyclic graph using DFS, or an empty list if a cycle exists.
Permutation Generator
Write a function that returns all permutations of a list of distinct integers.
Combination Generator
Write a recursive function that returns all combinations of length k from a list of distinct integers.
Letter Combinations of a Phone Number
Given a string of digits, return all possible letter combinations that the number could represent on a phone keypad.
Permutations
Write a function that returns every permutation of the elements in the input list.
Permutations II
Return all distinct permutations of a list of integers that may include duplicates.
Subsets
Return all subsets (the power set) of a list of distinct integers.
Subsets II
Given a collection of integers that might contain duplicates, return all possible unique subsets.
Palindrome Partitioning
Given a string s, return all possible palindrome partitioning of s.
Remove invalid parentheses
Given a string with parentheses and letters, return all valid strings after removing the minimum number of invalid parentheses.
Showing 241–264 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.