Problem description
https://leetcode-cn.com/problems/minimum-time-to-collect-all-apples-in-a-tree/
Solution
从后往前同步子节点状态给父节点。再遍历一遍子节点的状态得到路径数。
Code
1 | class Solution { |
https://leetcode-cn.com/problems/minimum-time-to-collect-all-apples-in-a-tree/
从后往前同步子节点状态给父节点。再遍历一遍子节点的状态得到路径数。
1 | class Solution { |
本文标题:Minimum Time to Collect All Apples in a Tree
文章作者:Night
发布时间:2020-05-10, 00:00:00
最后更新:2022-02-03, 17:52:51
原始链接:http://yoursite.com/2020/05/10/minTime/
许可协议: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。