Leetcode 3373. Maximize the Number of Target Nodes After Connecting Trees II
Given two trees, for each node i in the first tree, choose one node in the second tree to connect with a single edge so as to maximize the number of nodes at even distance (including itself) from i in the resulting graph. Key observation: distances depend only on parity, so the problem reduces to 2-coloring each tree and summing the size of i's parity class in tree1 with the larger parity-class size from tree2.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.