class Solution:

    def removeLeafNodes(self, root: Optional[TreeNode], target: int) -> Optional[TreeNode]:

        if root.left: root.left = self.removeLeafNodes(root.left, target)

        if root.right: root.right = self.removeLeafNodes(root.right, target)

        if root.left is None and root.right is None and root.val == target:

            return None

        return root


두번째 연쇄로 없어지는 예시보고 이건 무조건 재귀다 재귀가 아닐 수가 없다.. 라고 생각하니까 보임