- 博客(111)
- 收藏
- 关注
原创 998. Maximum Binary Tree II**
998. Maximum Binary Tree II**https://leetcode.com/problems/maximum-binary-tree-ii/题目描述We are given the root node of a maximum tree: a tree where every node has a value greater than any other value ...
2020-02-29 20:26:16 261
原创 515. Find Largest Value in Each Tree Row**
515. Find Largest Value in Each Tree Row**https://leetcode.com/problems/find-largest-value-in-each-tree-row/题目描述You need to find the largest value in each row of a binary tree.Example:Input: ...
2020-02-29 20:02:46 221
原创 513. Find Bottom Left Tree Value**
513. Find Bottom Left Tree Value**https://leetcode.com/problems/find-bottom-left-tree-value/题目描述Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 ...
2020-02-29 19:54:25 177
原创 1104. Path In Zigzag Labelled Binary Tree**
1104. Path In Zigzag Labelled Binary Tree**https://leetcode.com/problems/path-in-zigzag-labelled-binary-tree/题目描述In an infinite binary tree where every node has two children, the nodes are labelled...
2020-02-29 19:46:26 410
原创 145. Binary Tree Postorder Traversal***
145. Binary Tree Postorder Traversal***https://leetcode.com/problems/binary-tree-postorder-traversal/题目描述Given a binary tree, return the postorder traversal of its nodes’ values.Example:Input: [1...
2020-02-29 12:23:43 264
原创 94. Binary Tree Inorder Traversal**
94. Binary Tree Inorder Traversal**https://leetcode.com/problems/binary-tree-inorder-traversal/题目描述Given a binary tree, return the inorder traversal of its nodes’ values.Example:Input: [1,null,2,...
2020-02-29 11:37:40 208
原创 144. Binary Tree Preorder Traversal**
144. Binary Tree Preorder Traversal**https://leetcode.com/problems/binary-tree-preorder-traversal/题目描述Given a binary tree, return the preorder traversal of its nodes’ values.Example:Input: [1,nul...
2020-02-29 11:30:12 249
原创 102. Binary Tree Level Order Traversal**
102. Binary Tree Level Order Traversal**https://leetcode.com/problems/binary-tree-level-order-traversal/题目描述Given a binary tree, return the level order traversal of its nodes’ values. (ie, from lef...
2020-02-29 10:52:41 182
原创 1261. Find Elements in a Contaminated Binary Tree**
1261. Find Elements in a Contaminated Binary Tree**https://leetcode.com/problems/find-elements-in-a-contaminated-binary-tree/题目描述Given a binary tree with the following rules:root.val == 0If tree...
2020-02-29 09:59:51 298
原创 908. Smallest Range I*
908. Smallest Range I*https://leetcode.com/problems/smallest-range-i/题目描述Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i].After th...
2020-02-28 23:25:44 191
原创 894. All Possible Full Binary Trees**
894. All Possible Full Binary Trees**https://leetcode.com/problems/all-possible-full-binary-trees/题目描述A full binary tree is a binary tree where each node has exactly 0 or 2 children.Return a list ...
2020-02-28 22:58:28 238
原创 814. Binary Tree Pruning**
814. Binary Tree Pruning**https://leetcode.com/problems/binary-tree-pruning/题目描述We are given the head node root of a binary tree, where additionally every node’s value is either a 0 or a 1.Return ...
2020-02-28 22:11:21 224
原创 1325. Delete Leaves With a Given Value**
1325. Delete Leaves With a Given Value**https://leetcode.com/problems/delete-leaves-with-a-given-value/题目描述Given a binary tree root and an integer target, delete all the leaf nodes with value targe...
2020-02-28 21:51:09 219
原创 1305. All Elements in Two Binary Search Trees**
1305. All Elements in Two Binary Search Trees**https://leetcode.com/problems/all-elements-in-two-binary-search-trees/题目描述Given two binary search trees root1 and root2.Return a list containing all ...
2020-02-28 21:03:17 278
原创 1008. Construct Binary Search Tree from Preorder Traversal**
1008. Construct Binary Search Tree from Preorder Traversal**https://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal/题目描述Return the root node of a binary search tree that ...
2020-02-28 13:16:18 281
原创 654. Maximum Binary Tree**
654. Maximum Binary Tree**https://leetcode.com/problems/maximum-binary-tree/题目描述Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is t...
2020-02-28 11:53:05 272
原创 1302. Deepest Leaves Sum**
1302. Deepest Leaves Sum**https://leetcode.com/problems/deepest-leaves-sum/题目描述Given a binary tree, return the sum of values of its deepest leaves.Example 1:Input: root = [1,2,3,4,5,null,6,7,nul...
2020-02-28 11:33:35 743
原创 701. Insert into a Binary Search Tree**
701. Insert into a Binary Search Tree**https://leetcode.com/problems/insert-into-a-binary-search-tree/题目描述Given the root node of a binary search tree (BST) and a value to be inserted into the tree,...
2020-02-28 11:13:03 320
原创 1315. Sum of Nodes with Even-Valued Grandparent**
1315. Sum of Nodes with Even-Valued Grandparent**https://leetcode.com/problems/sum-of-nodes-with-even-valued-grandparent/题目描述Given a binary tree, return the sum of values of nodes with even-valued ...
2020-02-28 10:30:41 319
原创 687. Longest Univalue Path*
687. Longest Univalue Path*https://leetcode.com/problems/longest-univalue-path/题目描述C++ 实现 1该题的程序结构有点像 543. Diameter of Binary Tree*在下面代码中, 我们使用 path_length(root) 这个函数来统计以 root 为起点的 Univalue Path...
2020-02-28 09:47:13 287
原创 501. Find Mode in Binary Search Tree*
501. Find Mode in Binary Search Tree*https://leetcode.com/problems/find-mode-in-binary-search-tree/题目描述Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently oc...
2020-02-28 07:24:14 280
原创 110. Balanced Binary Tree*
110. Balanced Binary Tree*https://leetcode.com/problems/balanced-binary-tree/题目描述Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined ...
2020-02-27 23:27:04 185
原创 671. Second Minimum Node In a Binary Tree*
671. Second Minimum Node In a Binary Tree*https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/题目描述Given a non-empty special binary tree consisting of nodes with the non-negative valu...
2020-02-27 23:17:19 183
原创 572. Subtree of Another Tree*
572. Subtree of Another Tree*https://leetcode.com/problems/subtree-of-another-tree/题目描述Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values ...
2020-02-27 22:54:53 195
原创 437. Path Sum III*
437. Path Sum III*https://leetcode.com/problems/path-sum-iii/description/题目描述You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given v...
2020-02-27 10:47:45 3858 1
原创 113. Path Sum II**
113. Path Sum II**https://leetcode.com/problems/path-sum-ii/题目描述Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.Note: A leaf is a node with no...
2020-02-27 10:45:58 171
原创 112. Path Sum*
112. Path Sum*https://leetcode.com/problems/path-sum/题目描述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 gi...
2020-02-27 09:51:31 232
原创 111. Minimum Depth of Binary Tree*
111. Minimum Depth of Binary Tree*https://leetcode.com/problems/minimum-depth-of-binary-tree/题目描述Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shor...
2020-02-27 09:44:25 191
原创 101. Symmetric Tree*
101. Symmetric Tree*https://leetcode.com/problems/symmetric-tree/题目描述Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,...
2020-02-26 23:56:55 200
原创 563. Binary Tree Tilt*
563. Binary Tree Tilt*https://leetcode.com/problems/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 betwee...
2020-02-26 23:07:56 192
原创 543. Diameter of Binary Tree*
543. Diameter of Binary Tree*https://leetcode.com/problems/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...
2020-02-26 22:50:58 272
原创 1025. Divisor Game*
1025. Divisor Game*https://leetcode.com/problems/divisor-game/题目描述Alice and Bob take turns playing a game, with Alice starting first.Initially, there is a number N on the chalkboard. On each play...
2020-02-26 19:50:01 404
原创 235. Lowest Common Ancestor of a Binary Search Tree*
235. Lowest Common Ancestor of a Binary Search Tree*https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/题目描述Given a binary search tree (BST), find the lowest common ancesto...
2020-02-26 19:44:50 226
原创 257. Binary Tree Paths*
257. Binary Tree Paths*https://leetcode.com/problems/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 / \...
2020-02-26 09:45:17 205
原创 107. Binary Tree Level Order Traversal II*
107. Binary Tree Level Order Traversal II*https://leetcode.com/problems/binary-tree-level-order-traversal-ii/题目描述Given a binary tree, return the bottom-up level order traversal of its nodes’ values...
2020-02-26 08:58:24 180
原创 404. Sum of Left Leaves*
404. Sum of Left Leaves*https://leetcode.com/problems/sum-of-left-leaves/题目描述Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two ...
2020-02-25 22:37:56 286
原创 783. Minimum Distance Between BST Nodes*
783. Minimum Distance Between BST Nodes*https://leetcode.com/problems/minimum-distance-between-bst-nodes/题目描述Given a Binary Search Tree (BST) with the root node root, return the minimum difference ...
2020-02-25 22:24:56 282
原创 100. Same Tree*
100. Same Tree*Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same v...
2020-02-25 21:27:38 175
原创 993. Cousins in Binary Tree*
993. Cousins in Binary Tree*https://leetcode.com/problems/cousins-in-binary-tree/题目描述In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1.Two nodes of ...
2020-02-25 21:15:25 293
原创 530. Minimum Absolute Difference in BST*
530. Minimum Absolute Difference in BST*https://leetcode.com/problems/minimum-absolute-difference-in-bst/题目描述Given a binary search tree with non-negative values, find the minimum absolute differenc...
2020-02-25 20:49:26 234
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人