863. All Nodes Distance K in Binary Tree

We are given a binary tree (with root node root), a target node, and an integer value K. Return a list of the values of all nodes that have a distan...

2018-09-28 09:09:17

阅读数:13

评论数:0

865. Smallest Subtree with all the Deepest Nodes

Given a binary tree rooted at root, the depth of each node is the shortest distance to the root. A node is deepest if it has the largest depth possi...

2018-09-28 08:50:36

阅读数:8

评论数:0

685. Redundant Connection II

In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this ...

2018-09-14 09:26:44

阅读数:20

评论数:0

684. Redundant Connection

In this problem, a tree is an undirected graph that is connected and has no cycles. The given input is a graph that started as a tree with N nodes (...

2018-09-13 09:27:58

阅读数:17

评论数:0

563. Binary Tree Tilt

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 su...

2018-09-10 08:42:49

阅读数:17

评论数:0

543. Diameter of Binary Tree

Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path betw...

2018-09-10 08:21:28

阅读数:13

评论数:0

515. Find Largest Value in Each Tree Row

You need to find the largest value in each row of a binary tree. Example: Input: 1 / \ 3 2 / \ \ 5...

2018-09-07 09:06:58

阅读数:14

评论数:0

513. Find Bottom Left Tree Value

Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 3 Output: 1   Example 2:  In...

2018-09-07 08:55:46

阅读数:17

评论数:0

508. Most Frequent Subtree Sum

Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values...

2018-09-07 08:44:06

阅读数:17

评论数:0

108. Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is...

2018-09-06 09:08:48

阅读数:15

评论数:0

96. Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n? Example: Input: 3 Output: 5 Explanation: Given n = 3,...

2018-09-06 08:44:07

阅读数:10

评论数:0

257. Binary Tree Paths

Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Input: 1 / \ 2 3 \ 5 Output:...

2018-09-06 08:36:15

阅读数:14

评论数:0

501. Find Mode in Binary Search Tree

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 defi...

2018-09-05 09:28:49

阅读数:18

评论数:0

98. Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains o...

2018-09-05 09:08:45

阅读数:11

评论数:0

337. House Robber III

The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides...

2018-09-05 08:45:54

阅读数:20

评论数:0

199. Binary Tree Right Side View

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Examp...

2018-09-04 09:12:10

阅读数:14

评论数:0

173. Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the...

2018-09-04 09:01:36

阅读数:8

评论数:0

145. Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [3,2,...

2018-09-04 08:50:25

阅读数:7

评论数:0

129. Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1-&amp...

2018-09-04 08:37:29

阅读数:7

评论数:0

124. Binary Tree Maximum Path Sum

Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to an...

2018-09-03 09:17:52

阅读数:10

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭