← ALL NOTES
Divide and Conquer

1382. Balance a Binary Search Tree

Rebuild a BST into a height-balanced one with the same values. Two clean steps: an in-order traversal gives the sorted values, and a sorted array builds a balanced BST by taking the middle as root…

Loading…