Time Complexity · #43 · 2026-05-17
What's the Big-O?
Python ·Difficulty 2/3
How to play
Read the code and pick its time complexity from four Big-O choices. Think about loops, recursion, and hidden costs. Press 1–4 or click to answer.
Binary tree with n nodes and height h. What is the SPACE complexity?
def dfs_depth(root):
if root is None:
return 0
left = dfs_depth(root.left)
right = dfs_depth(root.right)
return 1 + max(left, right)
Loading your progress...
Press 1 through 4, or tap a numbered choice, to answer. Back to hub