Saturday, November 29, 2014

Path Sum 2

Problem

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,

Idea

DFS

Solution


No comments:

Post a Comment