标签:des style blog http color java strong for
题目:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:sum = 22
,
5 / 4 8 / / 11 13 4 / \ 7 2 1
return true, as there exist a root-to-leaf path 5->4->11->2
which sum is 22.
题解:
还是对树的操作,递归的解法:
非递归的解法(Reference:http://www.programcreek.com/2013/01/leetcode-path-sum/):
Path Sum leetcode java,布布扣,bubuko.com
标签:des style blog http color java strong for
原文地址:http://www.cnblogs.com/springfor/p/3879825.html