上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 32 下一页
摘要: Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt 阅读全文
posted @ 2019-03-15 16:09 MarkLeeBYR 阅读(84) 评论(0) 推荐(0)
摘要: 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 阅读(170) 评论(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 阅读(123) 评论(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 阅读(107) 评论(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 阅读(75) 评论(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 阅读(127) 评论(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 阅读(78) 评论(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 阅读(86) 评论(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 阅读(128) 评论(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 阅读(89) 评论(0) 推荐(0)
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 32 下一页