• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
June 02, 2022 |160 Views
Find multiplication of sums of data of leaves at same levels
  Share   Like
Description
Discussion

Given a Binary Tree, return following value for it. 
1) For every level, compute sum of all leaves if there are leaves at this level. Otherwise, ignore it. 
2) Return multiplication of all sums.
Examples: 
 

Input: Root of below tree
        2
      /   \
     7     5
            \
             9
Output: 63
First levels doesn't have leaves. Second level
has one leaf 7 and third level also has one 
leaf 9.  Therefore result is 7*9 = 63

Find multiplication of sums of data of leaves at same levels: https://www.geeksforgeeks.org/find-multiplication-of-sums-of-data-of-all-leaves-at-sane-levels/

Read More