InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

Print all root to leaf paths

You are given a binary tree. Find all paths from root to leaves of the binary tree.

Input Format

The only argument given is the root pointer of tree A.

Output Format

Return all paths from root to leaf.


1 <= number of nodes <= 50000
0 <= A[i] <= 10^9 

For Example

Input 1:
         / \
        4   8
       /   / \
      11  13  4
     /      / 
    7      5  
Output 1:
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Print all root to leaf paths on Interview Code Editor
Sign Up
to access hints and editorial solutions for Print all root to leaf paths


Click here to start solving coding interview questions