Search
⌘K

Leetcode 3530. Maximum Profit from Valid Topological Order in DAG

Given a DAG with node scores, find a topological ordering that maximizes the sum of score[i] * position(i) (positions are 1-based) while respecting all edge precedence constraints. With n ≤ 22 the core challenge is optimizing the order under partial-order constraints—typically solved by bitmask DP that schedules higher-score nodes as late as possible subject to dependencies.


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.