Search
⌘K

Leetcode 1468. Calculate Salaries

Given a directed management graph (often as an adjacency matrix) where an employee with no subordinates has salary 1 and every other employee's salary equals the sum of their direct subordinates' salaries, compute each employee's salary and return the total. This is a DAG dynamic-programming problem best solved via DFS with memoization or topological DP to aggregate subtree sums.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.