InterviewBit Academy is now Scaler!
Learn Tech Skills from Scratch @ Scaler EDGE

Root to Leaf Paths With Sum

Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.

For example:
Given the below binary tree and sum = 22,

             / \
            4   8
           /   / \
          11  13  4
         /  \    / \
        7    2  5   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 Root to Leaf Paths With Sum on Interview Code Editor
Sign Up
to access hints and editorial solutions for Root to Leaf Paths With Sum
Asked In:


Click here to start solving coding interview questions