October 01, 2024 |240 Views

    PROBLEM OF THE DAY : 30/09/2024 | Merge two BST 's

    Description
    Discussion

    Welcome to the daily solving of our PROBLEM OF THE DAY with Shivam Sinha 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 also build up problem-solving skills.

    Given two BSTs, return elements of merged BSTs in sorted form.

    Examples :

    Input: BST1:       5      /   \     3     6    / \   2   4   BST2:         2       /   \      1     3             \              7             /            6 Output: 1 2 2 3 3 4 5 6 6 7 Explanation: After merging and sorting the two BST we get 1 2 2 3 3 4 5 6 6 7.

    Give the problem a try before going through the video. All the best!!!
    Problem Link: https://practice.geeksforgeeks.org/problems/merge-two-bst-s/1