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 | 0508. 出现次数最多的子树元素和【Python】

2021-01-20
阅读 2 分钟
133
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 formed by the subtree rooted at that node (including the node itself). So what is the most frequent subtree sum value? If there is a tie, return al...

LeetCode | 0429. N 叉树的层序遍历【Python】

2021-01-11
阅读 2 分钟
173
Given an n-ary tree, return the level order traversal of its nodes' values.

LeetCode | 0235. 二叉搜索树的最近公共祖先【Python】

2021-01-11
阅读 2 分钟
155
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.

LeetCode | 0145. 二叉树的后序遍历【Python】

2021-01-11
阅读 3 分钟
153
Given the root of a binary tree, return the postorder traversal of its nodes' values.

LeetCode | 0144. 二叉树的前序遍历【Python】

2021-01-11
阅读 3 分钟
138
Given the root of a binary tree, return the preorder traversal of its nodes' values.

LeetCode | 0129. 求根到叶子节点数字之和【Python】

2021-01-10
阅读 2 分钟
181
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.

LeetCode | 0103. 二叉树的锯齿形层序遍历【Python】

2021-01-10
阅读 2 分钟
168
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).

LeetCode | 0222. 完全二叉树的节点个数【Python】

2021-01-07
阅读 2 分钟
159
Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between 1 and 2^h nodes inclusive at the last level h.

LeetCode | 1038. 把二叉搜索树转换为累加树【Python】

2021-01-07
阅读 3 分钟
132
Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.

LeetCode | 0538. 把二叉搜索树转换为累加树【Python】

2021-01-07
阅读 3 分钟
136
Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.

LeetCode | 0230. 二叉搜索树中第K小的元素【Python】

2021-01-07
阅读 2 分钟
294
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.

LeetCode | 0654. Maximum Binary Tree最大二叉树【Python】

2021-01-06
阅读 3 分钟
136
Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:

LeetCode | 0114. 二叉树展开为链表【Python】【Go】

2021-01-06
阅读 4 分钟
149
ProblemLeetCodeGiven a binary tree, flatten it to a linked list in-place.For example, given the following tree: {代码...} The flattened tree should look like: {代码...} 问题力扣给定一个二叉树,原地将它展开为一个单链表。例如,给定二叉树 {代码...} 将其展开为: {代码...} 思路递归 {代码...} Python3 ...

LeetCode 0116. 填充每个节点的下一个右侧节点指针【Python】【Go】

2021-01-06
阅读 3 分钟
188
You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:

LeetCode 0090. Subsets II子集II【Python】

2020-11-27
阅读 1 分钟
188
Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).

合集 | LeetCode 个人题解目录(长期更新)

2020-11-25
阅读 7 分钟
210
合集 | LeetCode 个人题解目录(长期更新)## 目录No.ProblemLeetCode力扣PythonGoSolutionDifficultyTag0017Letter Combinations of a Phone NumberLeetCode力扣Python CSDNMedium回溯、暴力0034Find First and Last Position of Element in Sorted ArrayLeetCode力扣Python CSDNMedium二分0039Combination SumLeetCode...

LeetCode 0078. Subsets子集【Python】

2020-10-24
阅读 1 分钟
169
Given a set of distinct integers, nums, return all possible subsets (the power set).

LeetCode | 0051. N-Queens N 皇后【Python】

2020-09-10
阅读 3 分钟
190
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.

LeetCode | 0040. Combination Sum II组合总和 II【Python】

2020-09-10
阅读 2 分钟
173
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.

Django 实战 | 搭一个 GitHub 用户展示网站 04

2020-08-28
阅读 4 分钟
163
一、搜索页面跳转在 urls.py 中添加一个 user 路径: {代码...} 在 views.py 中添加一个 user 方法: {代码...} 再在 templates 创建 user.html: {代码...} 然后启动 Django 服务,访问 http://127.0.0.1:8000/user/ 可以看到如下页面:在 base.html 中修改如下代码: {代码...} 然后在搜索框内搜索一个用户名,发现:...

Django 实战 | 搭一个 GitHub 用户展示网站 03

2020-08-28
阅读 3 分钟
173
在 views.py 中使用 requests 请求地址,再使用 json 解析数据,注意需要安装 requests,再在 render 中增加一个 key,起名为 api,对应值也是 api。

Django 实战 | 搭一个 GitHub 用户展示网站 02

2020-08-28
阅读 6 分钟
179
在 templates 文件里面新建一个 base.html,再到Bootstrap4中文文档找到 最基本的模板,拷贝代码到 base.html,在 home.html 中引入 base.html:

Django 实战 | 搭一个 GitHub 用户展示网站 01

2020-08-28
阅读 2 分钟
153
一、安装Python我之前写过一个安装教程,可以参考:Anaconda——最省心的 Python 版本。二、安装虚拟环境以管理员身份运行 PowerShell,修改 PowerShell 权限: {代码...} 查看已安装的库: {代码...} 安装虚拟环境: {代码...} 没安装成功,选择另一种方式,因为我安装的是 anaconda,所以可以直接使用 conda 安装库: {...

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

LeetCode | 0647. 回文子串【Medium】【Python】【中心扩展】【动态规划】

2020-08-21
阅读 3 分钟
164
Given a string, your task is to count how many palindromic substrings in this string.

LeetCode | 0111. 二叉树的最小深度【Easy】【Python】【二叉树】

2020-08-21
阅读 2 分钟
199
LeetCode 0111. Minimum Depth of Binary Tree二叉树的最小深度【Easy】【Python】【二叉树】

LeetCode | 0098. Validate Binary Search Tree验证二叉搜索树【Python】

2020-06-28
阅读 2 分钟
157
LeetCode 0098. Validate Binary Search Tree验证二叉搜索树【Medium】【Python】【二叉树】

LeetCode | 0700. Search in a Binary Search Tree二叉搜索树中的搜索【Python】

2020-06-28
阅读 2 分钟
135
LeetCode 0700. Search in a Binary Search Tree二叉搜索树中的搜索【Easy】【Python】【二叉树】