question= https://hack.codingblocks.com/contests/c/443/506
solution = https://ide.codingblocks.com/#/s/17551
1 test case failing
Your code is giving output even if it should not . Test Case :
10 true 20 true 30 false false true 50 false false true 40 true 60 false false true 73 false false
30
Other parts is fine .
Yeah ! It’s kinda logical error
Your code is still giving wrong answer for
10 true 20 true 30 false false true 50 false false true 40 true 60 false false true 73 false false
80
Listen, you can skip writing so much lines of code , it can be solved in some lines of code .
Just at every node check in its tree for given sum-node->data , if it is possible for sum=given sum-node->data
Then print the node data and return true. and dat’s it !
If u wanna code in this way , ping me back
ok share your code for the problem