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
相關文章
相關標籤/搜索