1p3a_oj Question

Find the Longest Path in a Tree (Tree Diameter)

Question Details

Given a tree, find its longest path. Input: The number of nodes n and a list of edges edges, where each edge is a tuple (u, v). Output: Return the length of the tree's longest path.

Full Details

🔒

Unlock all Citadel questions

Full insider details, leaked discussions, and candidate experiences.

or every company, $100/year →

About This Question

This is a reported interview question from a citadel interview for a swe role during the coding round.

It covers the following topics: Trees .

Topics