EasyTree· 77% acceptance
#882

Maximum Depth of Binary Tree 32

Easy

Return the maximum depth of a binary tree. Trees are passed as nested objects `{ val, left, right }`. Variant **#32**.

Example 1

Input: root = nested tree (depth 3)

Output: 3

Constraints

  • Number of nodes is in [0, 10^4]

Acceptance: 77% · Topics: tree, dfs, bfs

maxDepth

← All practice problems