← Oracle questions

Depth and diameter of a binary tree

Filed under Oracle

Given the root of a binary tree, compute both its maximum depth (number of nodes along the longest path from root to leaf) and its diameter (length of the longest path in edges between any two nodes)…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Oracle questions

Collected from public candidate posts and coding forums. Updated Nov 2026.