LeetCode | 0671. 二叉树中第二小的节点【Python】

2021-02-27
阅读 2 分钟
271
给定一个非空特殊的二叉树,每个节点都是正数,并且每个节点的子节点数量只能为 2 或 0。如果一个节点有两个子节点的话,那么该节点的值等于两个子节点中较小的一个。

LeetCode | 0655. 输出二叉树【Python】

2021-02-27
阅读 2 分钟
191
问题力扣在一个 m*n 的二维字符串数组中输出二叉树,并遵守以下规则:行数 m 应当等于给定二叉树的高度。列数 n 应当总是奇数。根节点的值(以字符串格式给出)应当放在可放置的第一行正中间。根节点所在的行与列会将剩余空间划分为两部分(左下部分和右下部分)。你应该将左子树输出在左下部分,右子树输出在右下部分。...

LeetCode | 0606. 根据二叉树创建字符串【Python】

2021-02-24
阅读 2 分钟
201
问题力扣你需要采用前序遍历的方式,将一个二叉树转换成一个由括号和整数组成的字符串。空节点则用一对空括号 "()" 表示。而且你需要省略所有不影响字符串与原始二叉树之间的一对一映射关系的空括号对。示例 1: {代码...} 示例 2: {代码...} 思路DFS {代码...} Python3 代码 {代码...} GitHub 链接Python

LeetCode | 0513. 找树左下角的值【Python】

2021-01-20
阅读 2 分钟
200
Given the root of a binary tree, return the leftmost value in the last row of the tree.

LeetCode | 0491. Increasing Subsequences递增子序列【Python】

2020-08-25
阅读 2 分钟
191
Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing subsequence should be at least 2.

LeetCode | 0529. Minesweeper扫雷游戏【Medium】【Python】【DFS】

2020-08-21
阅读 4 分钟
228
You are given a 2D char matrix representing the game board. 'M' represents an unrevealed mine, 'E' represents an unrevealed empty square, 'B' represents a revealed blank square that has no adjacent (above, below, left, right, and all 4 diagonals) mines, digit ('1' to '8') represents how many mine...