Question d’entretien chez LinkedIn

Implement a function to compute the maximum sum of any downward path in a tree represented by a parent array and node values.

Réponse à la question d'entretien

Utilisateur anonyme

8 sept. 2025

I designed a DFS-based recursive solution to traverse the tree, maintaining a global maximum path sum. Built an adjacency list to represent the tree. Used recursion to compute the max downward path sum from each node. Updated a global maximum at every node. Achieved O(n) time complexity. The solution passed all test cases.