Height of Binary Tree

00:00
EasyTreeDFSBFSRecursion
TCSInfosysWipro

Find the maximum depth of a binary tree — longest path from root to farthest leaf.

Examples

Input → [3,9,20,null,null,15,7]
Output → 3
Input → [1,null,2]
Output → 2
Input → []
Output → 0
Input → [1]
Output → 1