Search
⌘K

Leetcode 3372. Maximize the Number of Target Nodes After Connecting Trees I

Given two undirected trees, for each node i in the first tree find the maximum number of nodes (from both trees) that can be within distance ≤ k from i after you add one temporary edge connecting any node in the first tree to any node in the second tree. The core challenge is to use tree distances and radius-count precomputation to evaluate, for each i, the best cross-edge choice efficiently (n,m ≤ 1000).


Question Timeline

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

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