PROBLEM OF THE DAY: 15/10/2023 | Normal BST to Balanced BST
source link: https://www.geeksforgeeks.org/videos/problem-of-the-day-15102023-normal-bst-to-balanced-bst/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
PROBLEM OF THE DAY: 15/10/2023
Welcome to the daily solving of our PROBLEM OF THE DAY with Siddharth Hazra. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Binary Search Tree but will also help you build up problem-solving skills.
In this problem, we are given, a Binary Search Tree, modify the given BST such that it is balanced and has minimum possible height. Return the balanced BST.
Example:
Input:
30
/
20
/
10
Output:
20
/ \
10 30
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/normal-bst-to-balanced-bst/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/2ea53cf4-09ef-47c7-8238-f9b3b153744d
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK