814. Binary Tree Pruning
·
Algorithm
Binary Tree Pruning - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 노드의 값이 0, 1로만 이루어진 이진트리가 주어진다. 주어진 이진트리 중 0으로만 이루어진 가지를 가지치기(pruning)하고 루트 노드를 반환하는 문제다. 1. Recursion class Solution: def pruneTree(self, root: TreeNode) -> TreeNode: def dfs(cur): if not cur.left and not cur.rig..