Depth of a Tree

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • easy
  • Pro

Given a binary tree, find its depth: the number of nodes on the longest path from the root down to a leaf. Explain a recursive approach and an iterative one.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →