Leetcode刷题思路

算法思想题目分类

1.双指针类

  • 167. Two Sum II - Input array is sorted (Easy) 
  • 633. Sum of Square Numbers (Easy)
  • 345. Reverse Vowels of a String (Easy) 
  • 680. Valid Palindrome II (Easy)
  • 88. Merge Sorted Array (Easy)
  • 141. Linked List Cycle (Easy)
  • 524. Longest Word in Dictionary through Deleting (Medium) 

2.排序算法

  • 215. Kth Largest Element in an Array (Medium)
  • 347. Top K Frequent Elements (Medium)
  • 451. Sort Characters By Frequency (Medium)
  • 75. Sort Colors (Medium)

3.贪心算法

  • 455. Assign Cookies (Easy)
  • 435. Non-overlapping Intervals (Medium)
  • 452. Minimum Number of Arrows to Burst Balloons (Medium)
  • 406. Queue Reconstruction by Height(Medium)
  • 121. Best Time to Buy and Sell Stock (Easy)
  • 122. Best Time to Buy and Sell Stock II (Easy)
  • 605. Can Place Flowers (Easy)
  • 392. Is Subsequence (Medium)
  • 665. Non-decreasing Array (Easy)
  • 53. Maximum Subarray (Easy)
  • 763. Partition Labels (Medium)

4.二分查找

  • 69. Sqrt(x) (Easy)
  • 744. Find Smallest Letter Greater Than Target (Easy)
  • 540. Single Element in a Sorted Array (Medium)
  • 278. First Bad Version (Easy)
  • 153. Find Minimum in Rotated Sorted Array (Medium)
  • 34. Find First and Last Position of Element in Sorted Array

5.分治算法

  • 241. Different Ways to Add Parentheses (Medium)
  • 95. Unique Binary Search Trees II (Medium)

6.搜索类算法

广搜类:

  • 1091. Shortest Path in Binary Matrix(Medium)
  • 279. Perfect Squares (Medium)
  • 127. Word Ladder (Medium)

深搜类:

  • 695. Max Area of Island (Medium)
  • 200. Number of Islands (Medium)
  • 547. Friend Circles (Medium)
  • 130. Surrounded Regions (Medium)
  • 417. Pacific Atlantic Water Flow (Medium)

回溯类:(其实也是深搜)

  • 17. Letter Combinations of a Phone Number (Medium)
  • 93. Restore IP Addresses(Medium)
  • 79. Word Search (Medium)
  • 257. Binary Tree Paths (Easy)
  • 46. Permutations (Medium)
  • 47. Permutations II (Medium)
  • 77. Combinations (Medium)
  • 39. Combination Sum (Medium)
  • 40. Combination Sum II (Medium)
  • 216. Combination Sum III (Medium)
  • 78. Subsets (Medium)
  • 90. Subsets II (Medium)
  • 131. Palindrome Partitioning (Medium)
  • 37. Sudoku Solver (Hard)
  • 51. N-Queens (Hard)

7.动态规划类

斐波那契:

  • 70. Climbing Stairs (Easy)
  • 198. House Robber (Easy)
  • 213. House Robber II (Medium)

矩阵路径:

  • 64. Minimum Path Sum (Medium)
  • 62. Unique Paths (Medium)

数组区间:

  • 303. Range Sum Query - Immutable (Easy)
  • 413. Arithmetic Slices (Medium)

分割整数:

  • 343. Integer Break (Medim)
  • 279. Perfect Squares(Medium)
  • 91. Decode Ways (Medium)

最长递增子序列:

  • 300. Longest Increasing Subsequence (Medium)
  • 646. Maximum Length of Pair Chain (Medium)
  • 376. Wiggle Subsequence (Medium)

最长公共子序列:

  • 1143. Longest Common Subsequence

背包问题:

  • 416. Partition Equal Subset Sum (Medium)
  • 494. Target Sum (Medium)
  • 474. Ones and Zeroes (Medium)
  • 322. Coin Change (Medium)
  • 518. Coin Change 2 (Medium)
  • 139. Word Break (Medium)
  • 377. Combination Sum IV (Medium)

股票交易:

  • 309. Best Time to Buy and Sell Stock with Cooldown(Medium)
  • 714. Best Time to Buy and Sell Stock with Transaction Fee (Medium)
  • 123. Best Time to Buy and Sell Stock III (Hard)
  • 188. Best Time to Buy and Sell Stock IV (Hard)

字符串编辑:

  • 583. Delete Operation for Two Strings (Medium)
  • 72. Edit Distance (Hard)
  • 650. 2 Keys Keyboard (Medium)

7.数学类

  • 204. Count Primes (Easy)

进制转换:

  • 504. Base 7 (Easy)
  • 405. Convert a Number to Hexadecimal (Easy)
  • 168. Excel Sheet Column Title (Easy)

阶乘:

  • 172. Factorial Trailing Zeroes (Easy)

字符串加减:

  • 67. Add Binary (Easy)
  • 415. Add Strings (Easy)

相遇问题:

  • 462. Minimum Moves to Equal Array Elements II (Medium)

其他:

  • 169. Majority Element (Easy)
  • 367. Valid Perfect Square (Easy)
  • 326. Power of Three (Easy)
  • 238. Product of Array Except Self (Medium)
  • 628. Maximum Product of Three Numbers (Easy)

总结:

小贴士:

刚开始刷题都会有困难,也可能第一题都做不出来,(其实刚开始我就是,哈哈),甚至还可能连题目都看不懂

不过没关系,刚接触都是这样的,不要着急,一点一点去理解,算法思想要养成然后去运用不是一个短暂的过程。

对比一天刷五题,但是没理解,还不如就刷了一题,但是理解透了。

个人建议:

刚开始不用羞于看别人的解答,可以看,如果好长时间了都没有思路,可以去借鉴一下别人的题解。

但是最重要的是,看了不等于会了自己必须要再敲一遍,这时候也许会发现很多的问题,这些问题就是在懂了思想的情况下实现起来的问题。

只有自己在理解和实现都没有问题的情况下,才能算是掌握了,不能做思想的巨人。

这些归类的话是因为他们是基本类似的思想来解题,针对性的锻炼思维,在做完了一题之后还有类似的可以拿来训练,如果做题没有规律,思维跨度太大,很可能在做完下面的题就忘了上面的题

所以我习惯以这样归类的方式去刷题,分享给大家,供参考。

posted @ 2020-07-31 15:55  _未知的暖意  阅读(157)  评论(0编辑  收藏  举报