Root to Leaf Paths GFG POTD Python Solution geeks for geeks problem of the day

Опубликовано: 25 Октябрь 2024
на канале: VS Code
119
0

Problem - https://www.geeksforgeeks.org/problem...

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 1:

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

Input:
10
/ \
20 30
/ \
40 60
Output:
10 20 40
10 20 60
10 30