Live Practice

Binary Search Tree

Visualise the recursion. Implement a function to find the maximum depth of a BST with optimal time complexity.

# Find Max Depth
def maxDepth(root):
    if not root:
        return 0
    return 1 + max(
        maxDepth(root.left),
        maxDepth(root.right)
    )

Leaderboard

Weekly
1SophiaSophia14,820 XP
2Alex (You)Alex (You)12,400 XP
3MarcoMarco11,950 XP
4LiamLiam10,200 XP
5ChloeChloe9,800 XP

My Courses

Continue where you left off

Python 101
Beginner

Python 101

Progress45%
+12
Advanced Algorithms
Expert

Advanced Algorithms

Progress12%
+8

Web3 Fundamentals

Master the blockchain logic using our sandbox environment.

Time Spent

42h

+12% vs last week

Solved Puzzles

128

Top 5% Student

Course Completion

86%

2 Pending

Global Rank

#412

Global Active Labs