Practice Arena

Python Coding Challenges

Write real Python in the browser. Instant feedback. From beginner to expert.

467 challenges 330 easy 120 medium 17 hard
Data Structures & Algorithms medium

BFS level-order traversal

Return the level-order traversal of a binary tree as a list of lists.

BFS trees queues
+28 pts 25m
Data Structures & Algorithms hard

Topological sort (Kahn)

Return a valid topological ordering of tasks, or [] if a cycle exists.

graph BFS topological-sort
+45 pts 40m
Data Structures & Algorithms hard

Word ladder length

Return the length of the shortest transformation from beginWord to endWord changing one letter at a time.

BFS graph strings
+45 pts 40m
Data Structures & Algorithms medium

Shortest Path in Binary Matrix

Implement BFS to find the shortest path length from (0,0) to (n-1,n-1) in an n x n binary matrix, moving through 0 cells in 8 directions.

bfs grid shortest-path
+30 pts 30m
Trees & Binary Trees medium

Binary tree left side view

Given a binary tree, return the leftmost node's value at each depth, from top to bottom.

binary-tree levels bfs
+20 pts 20m
Trees & Binary Trees medium

Vertical Order Traversal

Compute the vertical order traversal of a binary tree, grouping nodes by column and row.

binary-tree bfs dictionary
+20 pts 25m
Graphs & Graph Algorithms hard

Minimum Cut

Given an undirected graph in adjacency-list form, return the size of the minimum edge cut that disconnects the graph.

graphs max-flow min-cut
+40 pts 35m
Graphs & Graph Algorithms medium

Bipartite Graph Check

Implement a function to check if an undirected graph is bipartite using graph coloring.

graphs bfs coloring
+25 pts 30m
Graphs & Graph Algorithms medium

Graph Coloring

Given an undirected graph, determine if it can be colored with two colors such that adjacent vertices have different colors.

graph bipartite bfs
+20 pts 20m
Graphs & Graph Algorithms medium

Course Schedule Can Finish

Given numCourses and prerequisites, return whether all courses can be finished without cyclic dependencies.

graph cycle topological
+25 pts 30m
Graphs & Graph Algorithms medium

Graph Valid Tree

Determine if n nodes and an edge list form a valid tree (connected and acyclic).

graph dfs bfs
+25 pts 30m
Graphs & Graph Algorithms medium

Cheapest Flights Within K Stops

Implement a function to compute the cheapest flight price from source to destination with at most K stops in a directed weighted graph.

graphs shortest-path dp
+30 pts 30m
Graphs & Graph Algorithms easy

Keys and Rooms

A classic graph traversal challenge: check if all rooms are reachable from room 0 using keys found in visited rooms.

graph dfs bfs
+10 pts 20m
Matrix & 2D Arrays medium

Number of Islands

Given a 2D grid of '1' (land) and '0' (water), count the number of islands surrounded by water.

matrix graph bfs
+25 pts 30m
Matrix & 2D Arrays medium

01 Matrix Nearest Zero

Given a binary matrix, return a matrix of the same shape where each cell contains the Manhattan distance to the nearest 0.

matrix bfs distance
+25 pts 30m
Matrix & 2D Arrays medium

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.

bfs grid simulation
+25 pts 25m

Showing 16 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

  1. Pick a category — basics, algorithms, strings, and more
  2. Open a challenge, read the statement, and edit the starter code
  3. 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.