3

PROBLEM OF THE DAY : 22/01/2024 | Paths from root with a specified sum

 7 months ago
source link: https://www.geeksforgeeks.org/videos/problem-of-the-day-22012024-paths-from-root-with-a-specified-sum/
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

Paths from root with a specified sum

January 23, 2024 |690 Views
PROBLEM OF THE DAY : 22/01/2024 | Paths from root with a specified sum
Problem of the Day, Data Structure and Algorithm, binary-tree
 Save  Share  2 Likes
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 Array but also build up problem-solving skills.

In this problem, given a Binary tree and a sum S, print all the paths, starting from root, that sums upto the given sum. Path not necessarily end on a leaf node.

Example :

Input : 
sum = 8
Input tree
        1
      /   \
    20      3
          /    \
        4       15   
       /  \     /  \
      6    7   8    9  


Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/paths-from-root-with-a-specified-sum/1

Read More

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK