DAY 48 |GFG: Children Sum Property in a BT | 9 Feb | Naman Jain |IIITG

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024
  • Check for Children Sum Property in a Binary Tree
    Medium
    Given a binary tree having n nodes. Check whether all of its nodes have the value equal to the sum of their child nodes. Return 1 if all the nodes in the tree satisfy the given properties, else it return 0.
    For every node, data value must be equal to the sum of data values in left and right children. Consider data value as 0 for NULL child. Also, leaves are considered to follow the property.
    Example 1:
    Input:
    Binary tree
    35
    / \
    20 15
    / \ / \
    15 5 10 5
    Output:
    1
    Explanation:
    Here, every node is sum of its left and right child.
    Problem link :www.geeksforge...
    Java Submisson Code : github.com/Nam...
    solve today potd gfg problem
    challenge me at gfg potd
    solve potd gfg
    gfg potd today
    today gfg potd
    gfg potd problems solutions
    gfg potd hard
    gfg potd easy
    gfg potd hard problem
    gfg potd medium problem
    geeks for geeks problem of the day easy problem
    geeks for geeks problem of the day medium problem
    geeks for geeks problem of the day hard problem
    code language used java
    code explained in java
    code writing in java
    know more about java
    java code gfg potd solution
    java c++ python gfg potd solution
    python potd gfg solution
    java easy code potd gfg

Комментарии •