二叉树是面试里常考的一类数据结构,其中有一类寻找路径问题很有意思。目前见过两种类型题目,都是先给出一个和,然后要求打印出节点值之和与此相等的路径问题。
Given a binary tree and a number, print all the root-to-leaf paths such that adding up all the values along the path equals the given number.
二叉树是面试里常考的一类数据结构,其中有一类寻找路径问题很有意思。目前见过两种类型题目,都是先给出一个和,然后要求打印出节点值之和与此相等的路径问题。
Given a binary tree and a number, print all the root-to-leaf paths such that adding up all the values along the path equals the given number.
应用推荐