979. Distribute Coins in Binary Tree——depth

题目分析: 每个节点需要移动的次数是  子节点需要移动的+当前的个数-1 Then, the number of moves we make from this node to and from its children is abs(dfs(node.left)) + abs(dfs(node.right)) class TreeNode(object): def __init__(se
相关文章
相关标签/搜索