Categorygithub.com/szhou12/leetcode-goleetcode2242-Maximum-Score-of-a-Node-Sequence
package
0.0.0-20241220224003-b7cf03a90b2b
Repository: https://github.com/szhou12/leetcode-go.git
Documentation: pkg.go.dev

# README

2242. Maximum Score of a Node Sequence

Solution idea

突破点:

valid node sequence with a length of 4

$\Rightarrow$ Brute-force

$\Rightarrow$ for any a-b (middle edge) in i-a-b-j, select neighbors i, j such that it gives max scores

$\Rightarrow$ for any node's neighbors, we only keep top 3 neighbors with highest scores (Greedy comes to play)

Time complexity = $O(E + V^2\log V)$ ?

Resource

【每日一题】LeetCode 2242. Maximum Score of a Node Sequence