Problems > Height of the Tree > Editorial

Height of the Tree — Solution & Editorial

Back to the Problem

BFS/DFS from the root; the height is the maximum depth reached.

Complexity: O(N)