4

PROBLEM OF THE DAY: 10/10/2023 | Nodes at given distance in binary tree

 11 months ago
source link: https://www.geeksforgeeks.org/videos/problem-of-the-day-10102023-nodes-at-given-distance-in-binary-tree/
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.
neoserver,ios ssh client

Nodes at given distance in binary tree

October 11, 2023 |810 Views
PROBLEM OF THE DAY: 10/10/2023 | Nodes at given distance in binary tree
Problem of the Day, Data Structures and Algorithms, binary-tree
 Save  Share  2 Likes
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 Tree but will also help you build up problem-solving skills.

In this problem, we are given, a binary tree, to find if it is height-balanced or not. 
A tree is height-balanced if the difference between the heights of left and right subtrees is not more than one for all nodes of the tree. 

Example :

Input:
     1
   /
  2
   \
    3 

Output: 0

Explanation: The max difference in height of the left subtree and right subtree is 2, which is greater than 1. Hence unbalanced

Give the problem a try before going through the video. All the best!!!

Problem Link: https://practice.geeksforgeeks.org/problems/check-for-balanced-tree/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/29aa15cf-467d-46d8-bfd7-0e9ce97c0d14

Read More

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK