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
Trees & Binary Trees easy

Binary Search Tree Class

Build a BinarySearchTree class and a sequence runner that executes a list of operations.

binary-search-tree classes traversal
+10 pts 15m
Trees & Binary Trees easy

Binary Tree Inorder Traversal

Implement an inorder traversal function that returns node values in left-root-right order.

binary-tree traversal recursion
+10 pts 15m
Trees & Binary Trees easy

Preorder Traversal

Implement a function that returns the preorder traversal values of a binary tree.

binary-tree traversal recursion
+10 pts 10m
Trees & Binary Trees easy

Postorder Traversal

Implement a function that returns the postorder traversal of a binary tree as a list of node values.

binary-tree traversal recursion
+10 pts 15m
Trees & Binary Trees easy

Maximum depth of tree

Implement max_depth(root) to return the maximum depth of a binary tree.

binary-tree recursion depth
+10 pts 15m
Trees & Binary Trees easy

Minimum Depth of Tree

Given a binary tree, compute the minimum depth from the root to the nearest leaf node.

binary-tree depth traversal
+10 pts 15m
Trees & Binary Trees easy

Symmetric Tree Check

Write a function that checks whether a binary tree is symmetric (a mirror of itself).

binary-tree recursion mirror
+10 pts 15m
Trees & Binary Trees easy

Same Tree Check

Write a function that checks whether two binary trees are identical in structure and node values.

binary tree recursion tree traversal
+10 pts 15m
Trees & Binary Trees easy

Insert into BST

Implement insertion into a Binary Search Tree while maintaining BST properties.

binary-search-tree recursion tree
+10 pts 15m

Showing 9 challenges · easy · Trees & Binary Trees

Trees & Binary Trees — Python coding challenges

What you will find here

This page lists trees & binary trees challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.

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.