Maximize an event's total fun with no employee attending alongside their direct manager.
Unlock detailed company stats for this questionUpgrade
Organizational hierarchy with the CEO at the top. There are n employees numbered 0 to n-1. Given arrays manager and fun_rating of length n: manager[i] is the manager of employee i (manager[0] = -1, the CEO has none) and fun_rating[i] is the fun rating of employee i. Total fun is the sum of the fun ratings of all participating employees. An employee and their direct manager cannot participate together. Find the max total fun and also return the list of participating employee IDs; if there are multiple solutions, any is fine. Example: manager = [-1, 0, 0, 1, 1, 2, 2], fun_rating = [5, 2, 4, 7, 2, 10, 9].
Community answers
No answers contributed by the community yet.
Related courses

Course

Course
Course
