Skip to content

wangcy6/leetcode

Repository files navigation

LeetCode

Travis Travis Travis Travis 历史共访问次数 今天被访问次数

秉承咱们号一贯的作风,拒绝奇技淫巧,拒绝过于诡异的技巧,因为这些技巧无法举一反三,学了也不划算。

一、最近进展

2019年12月25 你的目标

string 和 array 和int 就是弱点 这是基本功,

别考虑更加复杂算法了。把基本简单思路清晰,代码正确。

通过一篇生活中,智力中,还有其他现算法描述 转换成代码

数据题目 概率题等

二、 如何刷题通关,成为头号玩家

第一步 通过阅读教材 学习 基本数据结构,算法

book

  • 算法【重点推荐】

  • 算法导论

    阅读升级 :建议阅读英文版本,上面练习题也要跟着做

  • [数据结构(C语言版)].严蔚敏_吴伟民

  • 《大话数据结构》程杰

  • 漫画算法:小灰的算法之旅

    阅读入门: 国内教材上面三本至少选择一本。

  • 算法导论

    阅读升级 :建议阅读英文版本,上面练习题也要跟着做

  • 剑指offer 名企面试官精讲典型编程题

  • 编程之美——微软技术面试心得

阅读升华:经典永远不过时

百度网盘:
链接:https://pan.baidu.com/s/1gdAbGlMbHiWzS2YeSIHBWQ 
提取码:g4qm 
送人玫瑰 手留余香,给个star

第二步 线下大量的模拟练习

在 VS Code 中练习 leetcode插件

一、刷题正确姿势

  • 任务1 - 容易级别的题目的全部刷完毕,舍去中等和难度题目,.

    要求:独立思考,20分钟完成思路。

开始时间:2020-03-07 结束时间:xxx ,累计xx天

最近发现刷题感觉出现了一个致命的错误,无论视频还是博客上 完全中 难度题目,给出各种解释和推导,这个认知是偏见和误导。

看了半天根本不明白,对算法没有任何帮助,完全变成show,

从easy开始,学会里面推理更重要,更加实用。

  • 根据题号顺序刷题。必须经历3个月方式(推荐做法)

    原因1

    避免减少网络各种大神提供刷题分析影响,因为从最基层开始刷题,一步步成长,不是直接那最佳结果,从面试官角度 网络流传题目他么passed.

    前期不要说只看热点问题,其他的不看,这个方式是误导

    leetcod 太阳存在,你安装他们题目做就可以了,你去看别人参照太阳画出来月亮

    最后可能错误分析结果。切忌 切忌。

    原因2:能记住自己刷几个题目,别小看简单技术,每天一题。绕过投机取巧。

    检查: 0 -500你刷过了吗?如果没有,请停止看后面的其他题目

    • 刷题 流程阅读题目--分析 --手绘草稿图--算法文字描述--代码 (拿起盘茄闹钟 25分钟计时)

      image.png

    注意:刷题期间不要感觉难,看别人答案 更不要md ,微信账号记录刷题感悟,一切过程都舍去

    你现在战场上,你唯一做杀敌,各种技巧各种文章跳过,

    你现在战场上,你唯一做杀敌,各种技巧各种文章跳过,

    你现在战场上,你唯一做杀敌,各种技巧各种文章跳过,

    你能说自己不会吗?

    因为你行为(网上用浏览器看别人答案 和自己md)写总结 导致不不自信,一切灵丹妙药都不管用

    因为浏览器这工具消耗大量时间看一个有一个网址,最后可能看小说新闻 这些内容。

    自己写文章总结 就是放弃自己思考,里面拷贝复制然后中断思路。

    • 根据题型,然后顺序刷题,必须经历3个月方式

    针对薄弱环节 例如 回溯法 ,然后顺序刷题,按照从小到大排序。上来做最后一题或者典型题目 有投机取消心理,在没刷题之间前自己败下阵来

    ![

    ](./images/leetcode-zhihu.jpg)

二 、加入每日打卡社区(easy)

每日一题 早晨 看题目,中午和吃饭 休息思考整理思路,晚上写代码

如果 感觉有难度,请跟着花花酱视频学习

跟着花花酱 视频学习

跟着花花酱 视频学习

跟着花花酱 视频学习

跟着花花酱 视频学习

根据题型刷题:

  • 题型:数学

https://www.youtube.com/playlist?list=PLLuMmzMTgVK70LRovZHZwfRaMTboc6Xdc

题号

500

第三步 线上参加每周竞赛 或者现场面试

三、LeetCode Algorithm

(Notes: "♥" means you need to buy a book from Leetcode)

# Title Solution Difficulty DoIt
844 Backspace String Compare C++ Easy
837 Most Common Word C++ Easy
830 Positions of Large Groups Python Easy
804 Unique Morse Code Words C++ Easy
771 Jewels and Stones C++ Easy
747 Largest Number At Least Twice of Others Python Easy
746 Min Cost Climbing Stairs C++, Python Easy
721 Accounts Merge C++ Medium
717 1-bit and 2-bit Characters Python Easy
714 Best Time to Buy and Sell Stock with Transaction Fee C++ Medium
712 Minimum ASCII Delete Sum for Two Strings C++ Medium
695 Max Area of Island C++ Medium
687 Longest Univalue Path Python Easy
684 Redundant Connection Python Medium
674 Longest Continuous Increasing Subsequence Python Easy
671 Second Minimum Node In a Binary Tree Python Easy
665 Non-decreasing Array Python Easy
662 Maximum Width of Binary Tree Python Medium
661 Image Smoother Python Easy
655 Print Binary Tree Python Medium
652 Find Duplicate Subtrees Python Medium
647 Palindromic Substrings C++ Medium
643 Maximum Average Subarray I C++, Python Easy
628 Maximum Product of Three Numbers Python Easy
623 Add One Row to Tree Python Medium
581 Shortest Unsorted Continuous Subarray Python Easy
572 Subtree of Another Tree Python Easy
563 Binary Tree Tilt Python Easy
547 Friend Circles C++ Medium
543 Diameter of Binary Tree Python Easy
538 Convert BST to Greater Tree Python Easy
532 K-diff Pairs in an Array Python Easy
520 Detect Capital C++ Easy
518 Coin Change 2 C++ Medium
509 Fibonacci Number C++, Python Easy
477 Total Hamming Distance C++ Medium
463 Island Perimeter C++ Easy
450 DeleteNodeInABST Python Medium
449 Serialize and Deserialize BST Python Medium
437 Path Sum III Python Medium
418 SentenceScreenFitting C++ Easy
416 Partition Equal Subset Sum C++ Medium
415 Add Strings C++ Easy
414 Third Maximum Number C++, Python Easy
413 Arithmetic Slices C++ Medium
412 Fizz Buzz C++ Easy
410 Split Array Largest Sum C++ Hard
409 Longest Palindrome C++ Easy
406 Queue Reconstruction by Height C++ Medium
405 Convert a Number to Hexadecimal C++ Easy
404 Sum of Left Leaves C++, Python Easy
403 Frog Jump C++ Hard
402 Remove K Digits C++ Medium
401 Binary Watch C++ Easy
400 Nth Digit C++ Easy
399 Evaluate Division C++ Medium
398 Random Pick Index C++ Medium
397 Integer Replacement C++ Medium
396 Rotate Function C++ Easy
395 Longest Substring with At Least K Repeating Characters C++ Medium
394 Decode String C++ Medium
393 UTF-8 Validation C++ Medium
392 Is Subsequence C++ Medium
391 Perfect Rectangle C++ Hard
390 Elimination Game C++ Medium
389 Find the Difference C++ Easy
388 Longest Absolute File Path C++ Medium
387 First Unique Character in a String C++ Easy
386 Lexicographical Numbers C++ Medium
385 Mini Parser C++ Medium
384 Shuffle an Array C++ Medium
383 Ransom Note C++ Easy
382 Linked List Random Node C++ Medium
381 Insert Delete GetRandom O(1) - Duplicates allowed C++ Hard
380 Insert Delete GetRandom O(1) C++ Hard
377 Combination Sum IV C++ Medium
376 Wiggle Subsequence C++ Medium
371 Sum of Two Integers C++ Easy
367 Valid Perfect Square C++ Easy
357 Count Numbers with Unique Digits C++ Medium
350 Intersection of Two Arrays II C++ Easy
349 Intersection of Two Arrays C++ Easy
347 Top K Frequent Elements C++ Medium
345 Reverse Vowels of a String C++ Easy
344 Reverse String C++ Easy
343 Integer Break C++ Medium
342 Power of Four C++ Easy
341 Flatten Nested List Iterator C++ Medium
338 Counting Bits C++ Medium
337 House Robber III C++, Python Medium
336 Palindrome Pairs C++ Hard
334 Increasing Triplet Subsequence C++ Medium
332 Reconstruct Itinerary C++ Medium
331 Verify Preorder Serialization of a Binary Tree C++ Medium
330 Patching Array C++ Medium
329 Longest Increasing Path in a Matrix C++ Medium
328 Odd Even Linked List C++ Easy
327 Count of Range Sum C++ Hard
326 Power of Three C++ Easy
324 Wiggle Sort II C++ Medium
322 Coin Change C++ Medium
321 Create Maximum Number C++ Hard
319 Bulb Switcher C++ Medium
318 Maximum Product of Word Lengths C++ Medium
316 Remove Duplicate Letters C++ Hard
315 Count of Smaller Numbers After Self C++ Hard
313 Super Ugly Number C++ Medium
312 Burst Balloons C++ Hard
310 Minimum Height Trees C++ Medium
309 Best Time to Buy and Sell Stock with Cooldown C++ Medium
307 Range Sum Query - Mutable C++ Medium
306 Additive Number C++ Medium
304 Range Sum Query 2D - Immutable C++ Medium
303 Range Sum Query - Immutable C++ Easy
301 Remove Invalid Parentheses C++ Hard
300 Longest Increasing Subsequence C++ Medium
299 Bulls and Cows C++ Easy
297 Serialize and Deserialize Binary Tree C++ Medium
295 Find Median from Data Stream C++ Hard
292 Nim Game C++ Easy
290 Word Pattern C++ Easy
289 Game of Life C++ Medium
287 Find the Duplicate Number C++, Python Hard
285 Inorder Successor in BST Java Medium
284 Peeking Iterator C++ Medium
283 Move Zeroes C++ Easy
282 Expression Add Operators C++ Hard
279 Perfect Squares C++ Medium
278 First Bad Version C++, Java Easy
275 H-Index II C++ Medium
274 H-Index C++ Medium
273 Integer to English Words C++ Medium
268 Missing Number C++ Medium
264 Ugly Number II C++ Medium
263 Ugly Number C++ Easy
260 Single Number III C++ Medium
258 Add Digits C++ Easy
257 Binary Tree Paths C++ Easy
242 Valid Anagram C++, Java Easy
241 Different Ways to Add Parentheses C++, Python Medium
240 Search a 2D Matrix II C++, Java, Python Medium
239 Sliding Window Maximum C++ Hard
238 Product of Array Except Self C++ Medium
237 Delete Node in a Linked List C++ Easy
236 Lowest Common Ancestor of a Binary Tree C++, Java, Python Medium
235 Lowest Common Ancestor of a Binary Search Tree C++, Python Easy
234 Palindrome Linked List C++ Easy
233 Number of Digit One C++ Medium
232 Implement Queue using Stacks C++, Java Easy
231 Power of Two C++ Easy
230 Kth Smallest Element in a BST C++, Python Medium
229 Majority Element II C++ Medium
228 Summary Ranges C++ Easy
227 Basic Calculator II C++ Medium
226 Invert Binary Tree C++ Easy
225 Implement Stack using Queues C++, Java Medium
224 Basic Calculator C++ Medium
223 Rectangle Area C++ Easy
222 Count Complete Tree Nodes C++, Python Medium
221 Maximal Square C++ Medium
220 Contains Duplicate III C++, Python Medium
219 Contains Duplicate II C++, Python Easy
218 The Skyline Problem C++ Hard
217 Contains Duplicate C++ Easy
216 Combination Sum III C++ Medium
215 Kth Largest Element in an Array C++ Medium
214 Shortest Palindrome C++ Hard
213 House Robber II C++ Medium
212 Word Search II C++ Hard
211 Add and Search Word - Data structure design C++ Medium
210 Course Schedule II C++ Medium
209 Minimum Size Subarray Sum C++ Medium
208 Implement Trie (Prefix Tree) C++ Medium
207 Course Schedule C++ Medium
206 Reverse Linked List C++, Java Easy
205 Isomorphic Strings C++ Easy
204 Count Primes C++ Easy
203 Remove Linked List Elements C++ Easy
202 Happy Number C++, Python Easy
201 Bitwise AND of Numbers Range C++ Medium
200 Number of Islands C++, Python Medium
199 Binary Tree Right Side View C++ Medium
198 House Robber C++, Python Easy
191 Number of 1 Bits C++ Easy
190 Reverse Bits C++ Easy
189 Rotate Array C++, Java Easy
188 Best Time to Buy and Sell Stock IV C++ Hard
187 Repeated DNA Sequences C++ Medium
186 Reverse Words in a String II C++ Medium
179 Largest Number C++ Medium
174 Dungeon Game C++ Hard
173 Binary Search Tree Iterator C++, Java, Python Medium
172 Factorial Trailing Zeroes C++ Easy
171 Excel Sheet Column Number C++ Easy
170 Two Sum III - Data structure design C++ Easy
169 Majority Element C++ Easy
168 Excel Sheet Column Title C++ Easy
167 Two Sum II - Input array is sorted C++ Medium
166 Fraction to Recurring Decimal C++ Medium
165 Compare Version Numbers C++ Easy
164 Maximum Gap C++ Hard
163 Missing Ranges C++ Medium
162 Find Peak Element C++, Java Medium
161 One Edit Distance C++ Medium
160 Intersection of Two Linked Lists C++ Easy
159 Longest Substring with At Most Two Distinct Characters C++ Hard
158 Read N Characters Given Read4 II - Call multiple times C++ Hard
157 Read N Characters Given Read4 C++ Easy
156 Binary Tree Upside Down C++ Medium
155 Min Stack C++, Java Easy
154 Find Minimum in Rotated Sorted Array II C++ Hard
153 Find Minimum in Rotated Sorted Array C++, Java Medium
152 Maximum Product Subarray C++ Medium
151 Reverse Words in a String C++, Java Medium
150 Evaluate Reverse Polish Notation C++ Medium
149 Max Points on a Line C++ Hard
148 Sort List C++, Python Medium
147 Insertion Sort List C++, Python Medium
146 LRU Cache C++, Java Hard
145 Binary Tree Postorder Traversal C++, Python Hard
144 Binary Tree Preorder Traversal C++, Java Medium
143 Reorder List C++, Python Medium
142 Linked List Cycle II C++, Python Medium
141 Linked List Cycle C++ Medium
140 Word Break II C++ Hard
139 Word Break C++ Medium
138 Copy List with Random Pointer C++, Python Hard
137 Single Number II C++ Medium
136 Single Number C++ Medium
135 Candy C++ Hard
134 Gas Station C++ Medium
133 Clone Graph C++ Medium
132 Palindrome Partitioning II C++ Hard
131 Palindrome Partitioning C++ Medium
130 Surrounded Regions C++ Medium
129 Sum Root to Leaf Numbers C++, Python Medium
128 Longest Consecutive Sequence C++ Hard
127 Word Ladder C++ Medium
126 Word Ladder II C++ Hard
125 Valid Palindrome C++, Java Easy
124 Binary Tree Maximum Path Sum C++, Java Hard
123 Best Time to Buy and Sell Stock III C++ Hard
122 Best Time to Buy and Sell Stock II C++ Medium
121 Best Time to Buy and Sell Stock C++ Medium
120 Triangle C++, Java Medium
119 Pascal's Triangle II C++ Easy
118 Pascal's Triangle C++ Easy
117 Populating Next Right Pointers in Each Node II C++, Python Hard
116 Populating Next Right Pointers in Each Node C++, Python Medium
115 Distinct Subsequences C++ Hard
114 Flatten Binary Tree to Linked List C++, Python Medium
113 Path Sum II C++, Python Medium
112 Path Sum C++ Easy
111 Minimum Depth of Binary Tree C++ Easy
110 Balanced Binary Tree C++, Java Easy
109 Convert Sorted List to Binary Search Tree C++ Medium
108 Convert Sorted Array to Binary Search Tree C++ Medium
107 Binary Tree Level Order Traversal II C++ Easy
106 Construct Binary Tree from Inorder and Postorder Traversal C++, Python Medium
105 Construct Binary Tree from Preorder and Inorder Traversal C++, Python Medium
104 Maximum Depth of Binary Tree C++, Java Easy
103 Binary Tree Zigzag Level Order Traversal C++, Python Medium
102 Binary Tree Level Order Traversal C++, Java Easy
101 Symmetric Tree C++ Easy
100 Same Tree C++ Easy
99 Recover Binary Search Tree C++ Hard
98 Validate Binary Search Tree C++, Java, Python Medium
97 Interleaving String C++ Hard
96 Unique Binary Search Trees C++, Python Medium
95 Unique Binary Search Trees II C++, Python Medium
94 Binary Tree Inorder Traversal C++ Medium
93 Restore IP Addresses C++ Medium
92 Reverse Linked List II C++, Java, Python Medium
91 Decode Ways C++ Medium
90 Subsets II C++, Java Medium
89 Gray Code C++ Medium
88 Merge Sorted Array C++ Easy
87 Scramble String C++ Hard
86 Partition List C++, Python Medium
85 Maximal Rectangle C++ Hard
84 Largest Rectangle in Histogram C++ Hard
83 Remove Duplicates from Sorted List C++ Easy
82 Remove Duplicates from Sorted List II C++, Python Medium
81 Search in Rotated Sorted Array II C++ Medium
80 Remove Duplicates from Sorted Array II C++ Medium
79 Word Search C++ Medium
78 Subsets C++, Java, Python Medium
77 Combinations C++ Medium
76 Minimum Window Substring C++ Hard
75 Sort Colors C++ Medium
74 Search a 2D Matrix C++, Java Medium
73 Set Matrix Zeroes C++ Medium
72 Edit Distance C++ Hard
71 Simplify Path C++ Medium
70 Climbing Stairs C++, Java Easy
69 Sqrt(x) C++ Medium
68 Text Justification C++ Hard
67 Add Binary C++ Easy
66 Plus One C++ Easy ok
65 Valid Number C++ Easy
64 Minimum Path Sum C++, Java Medium
63 Unique Paths II C++, Java Medium
62 Unique Paths C++, Java Medium
61 Rotate List C++ Medium
60 Permutation Sequence C++ Medium
59 Spiral Matrix II C++ Medium
58 Length of Last Word C++, Java Easy
57 Insert Interval C++ Hard
56 Merge Intervals C++ Hard
55 Jump Game C++ Medium
54 Spiral Matrix C++ Medium
53 Maximum Subarray C++ Medium
52 N-Queens II C++doc Hard
51 N-Queens C++doc Hard
50 "Pow(x, n)" C++, Java Medium
49 Group Anagrams C++ Medium
48 Rotate Image C++ Medium
47 [Permutations II](./problems/47.全排列 II.md) C++ Hard ok
46 Permutations C++,go Medium ok
45 Jump Game II C++, Hard
44 Wildcard Matching C++ Hard
43 Multiply Strings C++ Medium
42 Trapping Rain Water C++ Hard
41 First Missing Positive C++ Hard
40 Combination Sum II C++ Medium
39 Combination Sum C++ Medium
38 Count and Say C++, Java Easy
37 Sudoku Solver C++ Hard
36 Valid Sudoku C++ Easy
35 Search Insert Position C++, Java Medium
34 Search for a Range C++, Java Medium
33 Search in Rotated Sorted Array C++, Java Hard
32 Longest Valid Parentheses C++ Hard
31 Next Permutation C++ Medium
30 Substring with Concatenation of All Words C++ Hard
29 Divide Two Integers C++ Medium
28 Implement strStr() C++, Java Easy
27 Remove Element C++ Easy
26 Remove Duplicates from Sorted Array C++, Java Easy
25 Reverse Nodes in k-Group C++ Hard
24 Swap Nodes in Pairs C++ Medium
23 Merge k Sorted Lists C++ Hard
22 Generate Parentheses C++ Medium
21 Merge Two Sorted Lists C++ Easy
20 Valid Parentheses C++ Easy
19 Remove Nth Node From End of List C++, Python Easy
18 4Sum C++ Medium
17 Letter Combinations of a Phone Number C++ Medium
16 3Sum Closest C++ Medium
15 3Sum C++ Medium
14 Longest Common Prefix C++ Easy
13 Roman to Integer C++ Easy
12 Integer to Roman C++ Medium
11 Container With Most Water C++ Medium
10 Regular Expression Matching C++ Hard
9 Palindrome Number C++, Java Easy
8 String to Integer (atoi) C++ Easy
7 Reverse Integer C++ Easy
6 ZigZag Conversion C++ Easy
5 Longest Palindromic Substring C++ Medium
4 Median of Two Sorted Arrays C++ Hard
3 Longest Substring Without Repeating Characters C++ Medium
2 Add Two Numbers C++ Medium
1 Two Sum C++, Go Easy

刷题的错误认知

刷了这么常时间题目,发现能把leetcode前面50个题目搞明白,已经很厉害了,里面包含思想很多了,以前跳跃这刷题完全是错误。网站总结典型题目都不靠谱,还是老实的吧前面50个题目,全部在做一次。

我以前刷这么多题目,为什么还是不行 因为看似很多,都是别人总结的,高考也不出

贡献

  • 如果有想法和创意,请提issue或者进群提
  • 如果想贡献代码,请提PR
  • 如果需要修改项目中图片,这里存放了项目中绘制图的源代码, 大家可以用draw.io打开进行编辑。