leetcode 257[easy]-----Binary Tree Paths

来源:互联网 发布:淘宝图片怎么加护盾 编辑:程序博客网 时间:2024/06/08 12:33

难度:easy


Given a binary tree, return all root-to-leaf paths.

For example, given the following binary tree:

   1 /   \2     3 \  5

All root-to-leaf paths are:

["1->2->5", "1->3"]
思路:开始学习两叉树,仍然是以练带学,边练边学的方式。用递归的方法完成。



原创粉丝点击