Problem 543 · Easy

Diameter of Binary Tree

DFS returns depth; global max tracks the widest path as left depth + right depth at each node.

Open the interactive visualisation