← Amazon questions

Max path sum in tree with up to 2 parents and 2 children

Filed under Amazon

Find the maximum path sum from any root to any leaf in O(n) time on a directed acyclic graph where nodes can have up to 2 parents and 2 children, and values can be negative.

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.