随笔分类 -  LeetCode

摘要:LeetCode 0876. Middle of the Linked List链表的中间结点【Easy】【Python】【双指针】 Problem "LeetCode" Given a non empty, singly linked list with head node , return a 阅读全文
posted @ 2020-03-23 22:39 Wonz 阅读(151) 评论(0) 推荐(0)
摘要:LeetCode 1387. Sort Integers by The Power Value将整数按权重排序【Medium】【Python】【排序】 Problem "LeetCode" The power of an integer is defined as the number of ste 阅读全文
posted @ 2020-03-22 10:03 Wonz 阅读(500) 评论(0) 推荐(0)
摘要:LeetCode 1385. Find the Distance Value Between Two Arrays两个数组间的距离值【Easy】【Python】【暴力】 Problem "LeetCode" Given two integer arrays and , and the integer 阅读全文
posted @ 2020-03-22 09:46 Wonz 阅读(340) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-03-21 20:55 Wonz 阅读(380) 评论(0) 推荐(0)
摘要:LeetCode 面试题33. 二叉搜索树的后序遍历序列【剑指Offer】【Medium】【Python】【递归】 问题 "力扣" 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历结果。如果是则返回 ,否则返回 。假设输入的数组的任意两个数字都互不相同。 参考以下这颗二叉搜索树: 示例 1: 阅读全文
posted @ 2020-03-21 19:36 Wonz 阅读(153) 评论(0) 推荐(0)
摘要:LeetCode 面试题32 III. 从上到下打印二叉树 III【剑指Offer】【Medium】【Python】【二叉树】【BFS】 问题 "力扣" 请实现一个函数按照之字形顺序打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右到左的顺序打印,第三行再按照从左到右的顺序打印,其他行以此类 阅读全文
posted @ 2020-03-21 00:00 Wonz 阅读(147) 评论(0) 推荐(0)
摘要:LeetCode 0102. Binary Tree Level Order Traversal二叉树的层次遍历【Medium】【Python】【BFS】 Problem "LeetCode" Given a binary tree, return the level order traversal 阅读全文
posted @ 2020-03-20 23:23 Wonz 阅读(118) 评论(0) 推荐(0)
摘要:LeetCode 面试题32 II. 从上到下打印二叉树 II【剑指Offer】【Easy】【Python】【二叉树】【BFS】 问题 "力扣" 从上到下按层打印二叉树,同一层的节点按从左到右的顺序打印,每一层打印到一行。 例如: 给定二叉树: , 返回其层次遍历结果: 提示: 1. `节点总数 L 阅读全文
posted @ 2020-03-20 22:58 Wonz 阅读(195) 评论(0) 推荐(0)
摘要:LeetCode 面试题32 I. 从上到下打印二叉树【剑指Offer】【Medium】【Python】【二叉树】【BFS】 问题 "力扣" 从上到下打印出二叉树的每个节点,同一层的节点按照从左到右的顺序打印。 例如: 给定二叉树: , 返回: 提示: 1. `节点总数 List[int]: imp 阅读全文
posted @ 2020-03-19 23:16 Wonz 阅读(137) 评论(0) 推荐(0)
摘要:LeetCode 0226. Invert Binary Tree翻转二叉树【Easy】【Python】【二叉树】【递归】 Problem "LeetCode" Invert a binary tree. Example: Input: Output: Trivia: This problem wa 阅读全文
posted @ 2020-03-19 22:06 Wonz 阅读(110) 评论(0) 推荐(0)
摘要:LeetCode 面试题27. 二叉树的镜像【剑指Offer】【Easy】【Python】【二叉树】【递归】 问题 "力扣" 请完成一个函数,输入一个二叉树,该函数输出它的镜像。 例如输入: 镜像输出: 示例 1: 限制: 代码地址 "GitHub链接" 阅读全文
posted @ 2020-03-19 21:35 Wonz 阅读(118) 评论(0) 推荐(0)
摘要:LeetCode 0409. Longest Palindrome最长回文串【Easy】【Python】【字符串】 Problem "LeetCode" Given a string which consists of lowercase or uppercase letters, find the 阅读全文
posted @ 2020-03-19 21:04 Wonz 阅读(147) 评论(0) 推荐(0)
摘要:LeetCode 面试题26. 树的子结构【Medium】【Python】【DFS】 问题 "力扣" 输入两棵二叉树A和B,判断B是不是A的子结构。(约定空树不是任意一个树的子结构) B是A的子结构, 即 A中有出现和B相同的结构和节点值。 例如: 给定的树 A: 给定的树 B: 返回 true,因 阅读全文
posted @ 2020-03-18 23:38 Wonz 阅读(172) 评论(0) 推荐(0)
摘要:LeetCode 0836. Rectangle Overlap矩形重叠【Easy】【Python】【数学】 Problem "LeetCode" A rectangle is represented as a list , where are the coordinates of its bott 阅读全文
posted @ 2020-03-18 21:45 Wonz 阅读(247) 评论(0) 推荐(0)
摘要:LeetCode 0106. Construct Binary Tree from Inorder and Postorder Traversal从中序与后序遍历序列构造二叉树【Medium】【Python】【二叉树】【递归】 Problem "LeetCode" Given inorder and 阅读全文
posted @ 2020-03-18 21:05 Wonz 阅读(123) 评论(0) 推荐(0)
摘要:LeetCode 0105. Construct Binary Tree from Preorder and Inorder Traversal从前序与中序遍历序列构造二叉树【Medium】【Python】【二叉树】【递归】 Problem "LeetCode" Given preorder and 阅读全文
posted @ 2020-03-18 20:29 Wonz 阅读(124) 评论(0) 推荐(0)
摘要:LeetCode 面试题07. 重建二叉树【剑指Offer】【Medium】【Python】【二叉树】【递归】 问题 "力扣" 输入某二叉树的前序遍历和中序遍历的结果,请重建该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。 例如,给出 返回如下的二叉树: 限制: 代码地址 "GitH 阅读全文
posted @ 2020-03-18 20:13 Wonz 阅读(163) 评论(0) 推荐(0)
摘要:LeetCode 面试题06. 从尾到头打印链表【剑指Offer】【Easy】【Python】【链表】 问题 "力扣" 输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。 示例 1: 限制: `0 List[int]: solution one: reverse res = [] 阅读全文
posted @ 2020-03-17 23:33 Wonz 阅读(244) 评论(0) 推荐(1)
摘要:LeetCode 面试题05. 替换空格【剑指Offer】【Easy】【Python】【字符串】 问题 "力扣" 请实现一个函数,把字符串 s 中的每个空格替换成"%20"。 示例 1: 限制: `0 str: solution one res = '' for c in s: if c == ' 阅读全文
posted @ 2020-03-17 22:39 Wonz 阅读(135) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-03-17 21:02 Wonz 阅读(241) 评论(0) 推荐(0)