摘要:
Solution1: class Solution { public TreeNode invertTree(TreeNode root) { if (root == null) return null; TreeNode tmp = root.left; root.left = invertTre 阅读全文
posted @ 2019-03-15 15:38
MarkLeeBYR
阅读(110)
评论(0)
推荐(0)
摘要:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文
posted @ 2019-03-15 15:33
MarkLeeBYR
阅读(100)
评论(0)
推荐(0)
摘要:
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2019-03-15 15:32
MarkLeeBYR
阅读(85)
评论(0)
推荐(0)
摘要:
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. class Solution { public TreeNode sortedArrayToBST(in 阅读全文
posted @ 2019-03-15 15:30
MarkLeeBYR
阅读(89)
评论(0)
推荐(0)
摘要:
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept 阅读全文
posted @ 2019-03-15 15:30
MarkLeeBYR
阅读(78)
评论(0)
推荐(0)
摘要:
Solution1:广度优先 class Solution { public List<List<Integer>> levelOrderBottom(TreeNode root) { Queue<TreeNode> q = new LinkedList<>(); List<List<Integer 阅读全文
posted @ 2019-03-15 15:29
MarkLeeBYR
阅读(84)
评论(0)
推荐(0)
摘要:
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 farthest l 阅读全文
posted @ 2019-03-15 15:21
MarkLeeBYR
阅读(56)
评论(0)
推荐(0)
摘要:
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). Solution1: class Solution { public boolean isSymmetric( 阅读全文
posted @ 2019-03-15 15:20
MarkLeeBYR
阅读(94)
评论(0)
推荐(0)
摘要:
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2019-03-15 15:17
MarkLeeBYR
阅读(93)
评论(0)
推荐(0)
摘要:
Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Solution 1://先遍历左节点然后把左节点设为 阅读全文
posted @ 2019-03-15 15:16
MarkLeeBYR
阅读(149)
评论(0)
推荐(0)
浙公网安备 33010602011771号