上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 32 下一页
摘要: Find the sum of all left leaves in a given binary tree. Solution1 :Recursive递归,注意:left leaves是左子叶,终端节点才是叶节点。所以只有9和15计算在内 class Solution { public int s 阅读全文
posted @ 2019-03-15 16:08 MarkLeeBYR 阅读(173) 评论(0) 推荐(0)
摘要: Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. class Solution { public List<Double> avera 阅读全文
posted @ 2019-03-15 16:05 MarkLeeBYR 阅读(130) 评论(0) 推荐(0)
摘要: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2019-03-15 16:03 MarkLeeBYR 阅读(110) 评论(0) 推荐(0)
摘要: You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep 阅读全文
posted @ 2019-03-15 16:02 MarkLeeBYR 阅读(77) 评论(0) 推荐(0)
摘要: * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } 阅读全文
posted @ 2019-03-15 16:01 MarkLeeBYR 阅读(130) 评论(0) 推荐(0)
摘要: Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a 阅读全文
posted @ 2019-03-15 16:00 MarkLeeBYR 阅读(83) 评论(0) 推荐(0)
摘要: Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define 阅读全文
posted @ 2019-03-15 15:55 MarkLeeBYR 阅读(87) 评论(0) 推荐(0)
摘要: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文
posted @ 2019-03-15 15:54 MarkLeeBYR 阅读(130) 评论(0) 推荐(0)
摘要: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: Solution1: class Solution { public List<String> bina 阅读全文
posted @ 2019-03-15 15:45 MarkLeeBYR 阅读(91) 评论(0) 推荐(0)
摘要: For example, the lowest common ancestor (LCA) of nodes 2 and 8 is 6. Another example is LCA of nodes 2 and 4 is 2, since a node can be a descendant of 阅读全文
posted @ 2019-03-15 15:40 MarkLeeBYR 阅读(109) 评论(0) 推荐(0)
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 32 下一页