public boolean hasPathSum(Node root, int sum) {
        if (root == null) {
            return false;
        }
        if (root.left == null && root.right == null) {
            return root.data == sum;
        }
        return hasPathSum(root.left, sum - root.data) || hasPathSum(root.right, sum - root.data);
    }
Date 10/06/2016
@author Tushar Roy

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

Time complexity O(n)

https://leetcode.com/problems/path-sum/
https://leetcode.com/problems/path-sum-ii/
src/com/interview/tree/PathSum.java