โ† Amazon questions

Longest Path in a Graph (Diameter)

Filed under Amazon

Given a connected, undirected tree or graph, find the length of the longest path present between any two nodes, known as the graph diameter.

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 Amazon questions

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