ques:https://hack.codingblocks.com/contests/c/443/507
code:https://ide.codingblocks.com/#/s/15245
1 test case not passing not able to figure out why??
Root to leaf ( binary tree)
You are passing the vector of path by reference. Thus, the new path gets adding up to the previous path (even you have visited it and answer does not exits in that path)
Also, it does not check whether the path is up to leaf or not (if sum is reached in between, your code prints it).
Try your code for inputs:
10 true 20 true 25 false false true 30 true 15 false false false true 40 false false
60
10 true 20 false true 30 true 15 false false false true 40 false false
60
ritik in your output you just simpply output the pair you did’t take care wheather tha last one is root or not .check this out it will pass all test cases
https://ide.codingblocks.com/#/s/15499