LeetCode | 每日一题 2021.11.10 | 495 提莫攻击

""" https://leetcode-cn.com/problems/teemo-attacking/ https://leetcode-cn.com/problems/teemo-attacking/solution/yi-ci-bian-li-bai-fen-bai-chao-guo-java-y8ooj/ https://leetcode-c...

11/17 12:41
3
LeetCode | 每日一题 2021.11.06 | 268. 丢失的数字

""" https://leetcode-cn.com/problems/missing-number/ https://leetcode-cn.com/problems/missing-number/solution/gong-shui-san-xie-yi-ti-wu-jie-pai-xu-ji-te3s/ 题目分析： 应该要求的...

11/06 15:09
39
LeetCode | 每日一题 2021.11.01 | 575. 分糖果

class Solution: def distributeCandies(self, candyType: List[int]) -> int: ans=0 #定义一个空set candySet=set() for candy in candyType: candySet.......

11/02 12:42
55
LeetCode | 每日一题 2021.10.30 | 260. 只出现一次的数字 III

""" https://leetcode-cn.com/problems/single-number-iii/ https://leetcode-cn.com/problems/single-number-iii/solution/zhi-chu-xian-yi-ci-de-shu-zi-iii-by-leet-4i8e/ https://leetco...

11/01 18:46
19
LeetCode | 54. 螺旋矩阵

""" https://leetcode-cn.com/problems/spiral-matrix/ https://leetcode-cn.com/problems/spiral-matrix/solution/xiao-ying-wu-python-54-dong-tai-bian-jie-xuaq/ 思路：模拟 1.从左->右循...

10/29 14:36
10
LeetCode | 每日一题 2021.10.26 | 496. 下一个更大元素 I

""" https://leetcode-cn.com/problems/next-greater-element-i/ https://leetcode-cn.com/problems/next-greater-element-i/solution/dong-hua-yan-shi-dan-diao-zhan-496xia-yi-ql65/ 用单...

10/26 16:32
9
LeetCode | 每日一题 2021.10.25 | 240. 搜索二维矩阵 II

""" https://leetcode-cn.com/problems/search-a-2d-matrix-ii/ 这个题目有多个解法：以下为： A：循环 B：二分查找 C:z形查找法 思路.A-循环 因为matrix是从左至右，从上到下有序数......

10/26 10:39
13
LeetCode | 每日一题 2021.10.22 | 4229. 求众数 II

""" https://leetcode-cn.com/problems/majority-element-ii/ https://leetcode-cn.com/problems/majority-element-ii/solution/qiu-zhong-shu-ii-by-leetcode-solution-y1rn/ https://leetc...

10/22 15:45
19
LeetCode | 每日一题 2021.10.20 | 453. 最小操作次数使数组元素相等

""" https://leetcode-cn.com/problems/minimum-moves-to-equal-array-elements/ https://leetcode-cn.com/problems/minimum-moves-to-equal-array-elements/solution/453-zui-xiao-cao-zuo-...

10/20 13:13
19
LeetCode.53 | 最大子序和

""" https://leetcode-cn.com/problems/maximum-subarray/ https://leetcode-cn.com/problems/maximum-subarray/solution/hua-jie-suan-fa-53-zui-da-zi-xu-he-by-guanpengchn/ 思路： 这个题...

10/19 11:25
30
LeetCode | 每日一题 2021.10.18 | 476. 数字的补数

""" https://leetcode-cn.com/problems/number-complement/solution/ https://leetcode-cn.com/problems/number-complement/solution/shu-zi-de-bu-shu-by-leetcode-solution-xtn8/ 思路： ...

10/18 14:21
28
LeetCode | 每日一题 2021.10.15 | 38. 外观数列

""" https://leetcode-cn.com/problems/count-and-say/ https://leetcode-cn.com/problems/count-and-say/solution/38-wai-guan-shu-lie-by-lllyyy-n-fzlp/ 递归思路：当前层的字符串=循环处...

10/15 20:39
9
LeetCode | 每日一题 2021.10.14 | 山峰数组的顶部

""" https://leetcode-cn.com/problems/B1IidL/ 思路： 方法1：循环查找最大值 因为题目给定的假设就是[由整数组成的山峰数组]， 实际上峰顶就是求整个数列的最大值； note:这......

10/14 14:19
0
LeetCode | 每日一题 2021.10.13 | 412. Fizz Buzz

#%% 2021.10.13 """ https://leetcode-cn.com/problems/fizz-buzz/ 思路： 这具题目属于比较简单的 1.循环数据从1~n 2.初始当前值的返回值s="" 2.进行整除判断 3.1 整除3,返回Fizz ......

10/14 10:00
36
LeetCode | 每日一题 2021.04.29 | 403.青蛙过河

""" 这个题目理解了半天，题目的意思是河流分段成等份未知长度；用stones列表表示有石头的位置x; 但青蛙每次跳jump只能跳前一次的jump+step[-1,0,1]；并且不能不跳或往回跳 索引-> 0 1 2 3 ...

05/17 15:34
13
LeetCode 43 | 字符串相乘

''' 这个题目和<零基础学算法>中计算阶乘相类似 思路:将较长数字的值与另一个数字中值相乘,将结果保存入对应数组,并进位 1.1 比较两个数值,总是将较小的值n1与较大值中n2的每一位相乘dig 1.2...

2020/07/26 09:02
113
LeetCode 42 | 接雨水

''' https://leetcode-cn.com/problems/trapping-rain-water/solution/wei-en-tu-jie-fa-zui-jian-dan-yi-dong-10xing-jie-j/ 数学法(韦恩)思路:其核心是S_left+S_right-S_matrix-S_column ...

2020/07/09 14:32
23
LeetCode.41 | 缺失的第一个正数

''' 我只想到用python的in进行,Hash表看题解才明白 https://leetcode-cn.com/problems/first-missing-positive/solution/tong-pai-xu-python-dai-ma-by-liweiwei1419/ In思路:比较简单,就用p...

2020/07/01 13:50
41
LeetCode 40 | 组合总和 II

''' 思路:参见39题方法.增加去重复 1.1:数组去重if cur>begin and candidates[cur-1]==candidates[cur] ''' class Solution: def combinationSum2(self,candidates,target): #排序 ......

2020/06/12 14:52
53
LeetCode 39 | 组合总和

''' backtrack:https://leetcode-cn.com/problems/combination-sum/solution/chao-qiang-gifzhu-ni-shi-yong-dong-tai-gui-hua-qiu/ bt思路:这题是比较典型的回溯算法,递归+剪枝进行加快速度...

2020/06/12 14:51
29