• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
October 16, 2023 |1.7K Views
PROBLEM OF THE DAY: 15/10/2023 | Normal BST to Balanced BST
Description
Discussion

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