摘要:
这道题为简单题 题目: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the 阅读全文
posted @ 2017-09-06 22:52
唐僧洗发爱飘柔
阅读(107)
评论(0)
推荐(0)
摘要:
这道题属于容易,还是挺简单的,但是我用的方法比较复杂。 题目: 思路: 1、我的想法是把树转换成列表,然后再遍历这个列表,判断是否两个元素相加为0,这种方法时间复杂度较高 2、大神也是将树节点存在列表中,建立一个空集合set,遍历列表,如果该(k - 该节点值)在集合中则返回True,否则将该节点值 阅读全文
posted @ 2017-09-06 11:51
唐僧洗发爱飘柔
阅读(126)
评论(0)
推荐(0)