文章 2018-03-31 来自:开发者社区

【LeetCode-面试算法经典-Java实现】【111-Minimum Depth of Binary Tree(二叉树的最小深度)】

原题   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 leaf node.  题目大意   给定一棵两叉树求树的最小深度。...

文章 2017-12-15 来自:开发者社区

[LeetCode] Serialize and Deserialize Binary Tree 二叉树的序列化和去序列化

Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to b....

文章 2017-12-15 来自:开发者社区

[LeetCode] Binary Tree Upside Down 二叉树的上下颠倒

Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it upside down and turn it into a tree where the origi....

文章 2017-12-15 来自:开发者社区

[LeetCode] Verify Preorder Serialization of a Binary Tree 验证二叉树的先序序列化

One way to serialize a binary tree is to use pre-oder traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as #. ....

文章 2017-12-15 来自:开发者社区

[LeetCode] Binary Tree Longest Consecutive Sequence 二叉树最长连续序列

Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connecti....

文章 2017-12-15 来自:开发者社区

[LeetCode] Binary Tree Vertical Order Traversal 二叉树的竖直遍历

Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column). If two nodes are in the same row and column, the order should be fr...

文章 2017-12-13 来自:开发者社区

[LeetCode] Find Leaves of Binary Tree 找二叉树的叶节点

Given a binary tree, find all leaves and then remove those leaves. Then repeat the previous steps until the tree is empty. Example: Given binary tree  1 / \ 2 3 / \ 4 5 Returns [4, 5, 3...

文章 2017-12-11 来自:开发者社区

[LeetCode] Minimum Depth of Binary Tree 二叉树的最小深度

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 leaf node.  二叉树的经典问题之最小深度问题就是就最短路径的节点个数,还是用深度优...

文章 2017-12-11 来自:开发者社区

[LeetCode] Binary Tree Level Order Traversal 二叉树层序遍历

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ .....

文章 2017-12-11 来自:开发者社区

[LeetCode] Binary Tree Level Order Traversal II 二叉树层序遍历之二

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree {3,9,20,...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

算法编程

开发者社区在线编程频道官方技术圈。包含算法资源更新,周赛动态,每日一题互动。

+关注