• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
July 06, 2024 |580 Views

PROBLEM OF THE DAY : 05/07/2024 | Vertical Width of a Binary Tree

Description
Discussion

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

Given a Binary Tree. You need to find and return the vertical width of the tree.

Examples:

Input : 
                  1
                /    \
             2         3
           /   \      /  \
        4       5  6     7
                       \      \
                         8     9

Output: 6   
               
Explanation: The width of a binary tree is the number of vertical paths in that tree.

Problem Link: https://practice.geeksforgeeks.org/problems/vertical-width-of-a-binary-tree/1
Solution Link: https://ide.geeksforgeeks.org/online-cpp14-compiler/3b573c93-1c3d-482e-a659-2b1118da1400