EasyTree· 68% acceptance
#856

Maximum Depth of Binary Tree 6

Easy

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

Example 1

Input: root = nested tree (depth 1)

Output: 1

Constraints

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

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

maxDepth

← All practice problems