Practice Arena

Python Coding Challenges

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

925 challenges 556 easy 323 medium 46 hard
Strings & Text medium

Zigzag string conversion

Encode a string in zigzag order across numRows rows, then read row by row.

strings math
+22 pts 20m
Strings & Text medium

Custom Sort String

Given a string s and an order string, reorder s so that characters that appear in order come first in that order, and all other characters are appended in stable original order.

sorting strings custom-order
+15 pts 20m
Functions & Closures medium

Function composition

Return a function that applies f after g: compose(f, g)(x) == f(g(x)).

functional closures higher-order
+20 pts 18m
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 medium

Heap Sort Implementation

Implement the heap sort algorithm to sort a list of comparable elements in non-decreasing order.

heap sorting in-place
+20 pts 25m
Data Structures & Algorithms medium

Radix Sort

Implement LSD radix sort to sort a list of non-negative integers in ascending order.

radix-sort sorting counting-sort
+25 pts 25m
Data Structures & Algorithms medium

Reconstruct Itinerary

Given a list of airline tickets, reconstruct the itinerary in order using each ticket exactly once, choosing the lexicographically smallest path when multiple options exist.

graph backtracking dfs
+30 pts 25m
Data Structures & Algorithms medium

AST Visitor Lite

Implement a depth-first traversal of a simplified AST and return identifier names in order.

trees traversal ast
+20 pts 20m
Data Structures & Algorithms medium

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.

binary-tree queue bfs
+20 pts 25m
Data Structures & Algorithms medium

Strobogrammatic number II

Given a positive integer n, return all strobogrammatic numbers of length n in ascending order.

strings recursion number
+25 pts 20m
Dynamic Programming medium

Interleaving string

Given three strings s1, s2, and s3, check if s3 is formed by interleaving s1 and s2 while preserving the order of each input string.

dynamic-programming strings dp
+30 pts 30m
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
Trees & Binary Trees medium

Kth Smallest in BST

Implement a function that returns the k-th smallest value in a binary search tree.

bst inorder recursion
+25 pts 25m
Trees & Binary Trees medium

Zigzag Level Order Traversal

Implement a function that returns the zigzag level-order traversal of a binary tree.

binary-tree breadth-first-search queue
+25 pts 25m
Graphs & Graph Algorithms medium

Alien Dictionary Order

Given a sorted list of words in an alien language, derive the order of its unique letters.

graph topological-sort string
+30 pts 30m
Graphs & Graph Algorithms medium

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.

topological-sort dfs graph
+20 pts 25m
Graphs & Graph Algorithms medium

Course Schedule Ordering

Determine a valid sequence to complete all courses respecting prerequisite constraints.

graph topological-sort bfs
+30 pts 30m
Recursion & Backtracking medium

Letter Tile Possibilities

Given a string of letter tiles, count the number of distinct non-empty sequences that can be formed using any non-empty subset in any order.

backtracking counting strings
+25 pts 25m
Greedy Algorithms medium

Queue Reconstruction by Height

Given shuffled pairs of (height, number_of_taller_people_in_front), reconstruct the original queue order.

greedy sorting insertion
+25 pts 25m
Binary Search medium

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.

binary-search greedy arrays
+30 pts 25m
Binary Search medium

Find k Closest Elements to Target

Return exactly k elements from a sorted list that are closest to a given target, preserving order.

binary-search sorting two-pointers
+20 pts 20m
Stacks & Queues medium

Validate Stack Sequences

Given two sequences of distinct integers, verify whether the second sequence is a valid pop order for a stack given the first sequence as push order.

stack simulation sequences
+20 pts 20m
Stacks & Queues medium

Asteroid Collision

Simulate asteroid collisions with a stack and return the remaining asteroids in original order.

stack simulation arrays
+20 pts 25m
Heaps & Priority Queues medium

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.

heap frequency counter
+20 pts 25m

Showing 1–24 of 30 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

  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.