• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 09, 2024 |150 Views
PROBLEM OF THE DAY : 08/05/2024 | Root to Leaf Paths
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 also build up problem-solving skills.

In this problem, we are given a Binary Tree of nodes, you need to find all the possible paths from the root node to all the leaf nodes of the binary tree.

Example :

Input:
      1
   /     \
  2       3
Output: 
1 2 
1 3 
Explanation: 
All possible paths:
1->2
1->3

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