Search
⌘K

Leetcode 2242. Maximum Score of a Node Sequence

Given an undirected graph with node scores, find the maximum sum of scores of any simple path of exactly four nodes (a–b–c–d with edges between adjacent nodes), or return -1 if no such path exists. Large constraints (n, m up to ~5·10^4) mean brute-force enumeration is too slow and you must prune/limit neighbor choices to compute the optimum efficiently.


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.