Leetcode 3540. Minimum Time to Visit All Houses
Given a tree (or connected graph) with certain nodes marked as houses and unit travel time along edges, compute the minimum time to start at a given root and visit all house nodes (optionally returning to the start). The core challenge is to prune subtrees with no houses and use DFS/post-order accumulation to count only the necessary edge traversals, minimizing repeated travel (a tree-specific optimization of TSP-like routing).
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.