随笔分类 - LeetCode
摘要:LeetCode 0876. Middle of the Linked List链表的中间结点【Easy】【Python】【双指针】 Problem "LeetCode" Given a non empty, singly linked list with head node , return a
阅读全文
摘要:LeetCode 1387. Sort Integers by The Power Value将整数按权重排序【Medium】【Python】【排序】 Problem "LeetCode" The power of an integer is defined as the number of ste
阅读全文
摘要:LeetCode 1385. Find the Distance Value Between Two Arrays两个数组间的距离值【Easy】【Python】【暴力】 Problem "LeetCode" Given two integer arrays and , and the integer
阅读全文
摘要:LeetCode 0365. Water and Jug Problem水壶问题【Medium】【Python】【BFS】【数学】 Problem "LeetCode" You are given two jugs with capacities x and y litres. There is a
阅读全文
摘要:LeetCode 面试题33. 二叉搜索树的后序遍历序列【剑指Offer】【Medium】【Python】【递归】 问题 "力扣" 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历结果。如果是则返回 ,否则返回 。假设输入的数组的任意两个数字都互不相同。 参考以下这颗二叉搜索树: 示例 1:
阅读全文
摘要:LeetCode 面试题32 III. 从上到下打印二叉树 III【剑指Offer】【Medium】【Python】【二叉树】【BFS】 问题 "力扣" 请实现一个函数按照之字形顺序打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右到左的顺序打印,第三行再按照从左到右的顺序打印,其他行以此类
阅读全文
摘要:LeetCode 0102. Binary Tree Level Order Traversal二叉树的层次遍历【Medium】【Python】【BFS】 Problem "LeetCode" Given a binary tree, return the level order traversal
阅读全文
摘要:LeetCode 面试题32 II. 从上到下打印二叉树 II【剑指Offer】【Easy】【Python】【二叉树】【BFS】 问题 "力扣" 从上到下按层打印二叉树,同一层的节点按从左到右的顺序打印,每一层打印到一行。 例如: 给定二叉树: , 返回其层次遍历结果: 提示: 1. `节点总数 L
阅读全文
摘要:LeetCode 面试题32 I. 从上到下打印二叉树【剑指Offer】【Medium】【Python】【二叉树】【BFS】 问题 "力扣" 从上到下打印出二叉树的每个节点,同一层的节点按照从左到右的顺序打印。 例如: 给定二叉树: , 返回: 提示: 1. `节点总数 List[int]: imp
阅读全文
摘要:LeetCode 0226. Invert Binary Tree翻转二叉树【Easy】【Python】【二叉树】【递归】 Problem "LeetCode" Invert a binary tree. Example: Input: Output: Trivia: This problem wa
阅读全文
摘要:LeetCode 面试题27. 二叉树的镜像【剑指Offer】【Easy】【Python】【二叉树】【递归】 问题 "力扣" 请完成一个函数,输入一个二叉树,该函数输出它的镜像。 例如输入: 镜像输出: 示例 1: 限制: 代码地址 "GitHub链接"
阅读全文
摘要:LeetCode 0409. Longest Palindrome最长回文串【Easy】【Python】【字符串】 Problem "LeetCode" Given a string which consists of lowercase or uppercase letters, find the
阅读全文
摘要:LeetCode 面试题26. 树的子结构【Medium】【Python】【DFS】 问题 "力扣" 输入两棵二叉树A和B,判断B是不是A的子结构。(约定空树不是任意一个树的子结构) B是A的子结构, 即 A中有出现和B相同的结构和节点值。 例如: 给定的树 A: 给定的树 B: 返回 true,因
阅读全文
摘要:LeetCode 0836. Rectangle Overlap矩形重叠【Easy】【Python】【数学】 Problem "LeetCode" A rectangle is represented as a list , where are the coordinates of its bott
阅读全文
摘要:LeetCode 0106. Construct Binary Tree from Inorder and Postorder Traversal从中序与后序遍历序列构造二叉树【Medium】【Python】【二叉树】【递归】 Problem "LeetCode" Given inorder and
阅读全文
摘要:LeetCode 0105. Construct Binary Tree from Preorder and Inorder Traversal从前序与中序遍历序列构造二叉树【Medium】【Python】【二叉树】【递归】 Problem "LeetCode" Given preorder and
阅读全文
摘要:LeetCode 面试题07. 重建二叉树【剑指Offer】【Medium】【Python】【二叉树】【递归】 问题 "力扣" 输入某二叉树的前序遍历和中序遍历的结果,请重建该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。 例如,给出 返回如下的二叉树: 限制: 代码地址 "GitH
阅读全文
摘要:LeetCode 面试题06. 从尾到头打印链表【剑指Offer】【Easy】【Python】【链表】 问题 "力扣" 输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。 示例 1: 限制: `0 List[int]: solution one: reverse res = []
阅读全文
摘要:LeetCode 面试题05. 替换空格【剑指Offer】【Easy】【Python】【字符串】 问题 "力扣" 请实现一个函数,把字符串 s 中的每个空格替换成"%20"。 示例 1: 限制: `0 str: solution one res = '' for c in s: if c == '
阅读全文
摘要:LeetCode 0240. Search a 2D Matrix II搜索二维矩阵 II【Medium】【Python】【数组】 Problem "LeetCode" Write an efficient algorithm that searches for a value in an m x
阅读全文

浙公网安备 33010602011771号