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.
判断是否存在路径,满足路径的和为Sum。
代码:
是113的简单版本,原理差不多。
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.
判断是否存在路径,满足路径的和为Sum。
是113的简单版本,原理差不多。