1038. Binary Search Tree to Greater Sum Tree
·
Algorithm
Binary Search Tree to Greater Sum Tree - 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 이진 탐색 트리가 주어진다. 주어진 이진 탐색 트리 노드들의 값을 (기존 값 + 자신보다 큰 값을 가진 노드들의 값의 합)으로 변환한 뒤 root를 반환하는 문제다. 새로운 트리를 만드는 것이 아니라 기존 트리를 조작해서 문제 조건대로 만든 뒤 입력받은 root를 그대로 반환해야 한다. 1. Recursion 01 class Solution(o..