NeetCode #433LC-1443MediumTrees
← Back to All Problems#433 · #1443 · Minimum Time to Collect All Apples in a Tree(收集树上所有苹果的最少时间)
📌 Problem Statement & Constraints
Given an undirected tree with
n nodes rooted at 0, edges, and a boolean array hasApple, return the minimum time in seconds to collect all apples and return to node 0. Each edge takes 1 second to traverse. Constraints: 1 <= n <= 10^5, edges.length == n - 1, hasApple.length == n.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!