Wednesday, July 2, 2014

Root to leaf path sum equal to a given number



Idea:

- First check base conditions as per arguments passed in function.
- Take a subsum as a local variable for per stack which substracts the previous node values.
- check if node is leaf and subsum equals to zero then return true.
- if we find above condition true in any call then it has DONE and return true for each calls.


Program:


No comments:

Post a Comment