← Morgan Stanley questions
CodingReported in a candidate post, Jul 2020

Find max heights for all nodes considering each as root

Filed under Morgan Stanley

Given an undirected tree with N nodes (N < 1000), calculate the maximum height (longest path from the root to a leaf) for every node if that node were chosen as the root.

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 Morgan Stanley questions

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