
1382. Balance a Binary Search Tree
·
Algorithm
Balance a Binary Search 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 이진 탐색 트리가 주어진다. 주어진 이진 탐색 트리를 균형 이진 탐색 트리로 만들어 반환하는 문제다. 균형 이진 탐색 트리는 모든 노드의 left, right subtree의 depth 차이가 1 이하인 이진 탐색 트리다. 1. 중위 순회를 이용한 트리 생성 class Solution: def balanceBST(self, root: TreeNode) -> Tr..