Company: Airtel_24sep
Difficulty: medium
Tree Operations Problem Description Distance: Distance between two nodes is the minimum number of edges to be traversed to reach one node from another. Height of a tree: The height of a tree is the number of edges on the longest path from the root node to a leaf. You are given nodes of a binary tree, its height and an integer k. Count the number of distinct pairs of leaf nodes where the distance between these leaf nodes is less than or equal to k and print the same. Note: Print -1 if the input tree is empty i.e., the height of the tree is -1. Print 0 if no such pair is found. Input Format The input is in the following format: The first line takes an integer N. The second line takes an integer R as input which represents the height of the tree (the root node is at 0th level). (If the height is equal to -1, means empty tree.) Next N+1 lines contain the nodes in the tree in level order. Each line represents the nodes present in the binary tree at the i-th level. 1st line contains level 0