LeetCode刷题日记

Date:2020/4/14

  1. 题目:https://leetcode-cn.com/problems/add-two-numbers-ii/                           tip:利用栈模拟从后往前操作
  2. 题目:https://leetcode-cn.com/problems/sort-the-matrix-diagonally/                     tip:   对角线遍历,然后利用set插入自动排序。则获取迭代器所指向的key是有序的。
  3. 题目:https://leetcode-cn.com/problems/sort-integers-by-the-power-value/         tip: 也是利用map中内部key是自动排序,所以依次遍历到对应位置即可(一定要清楚审题)

Date:2020/4/15

  1. 题目:https://leetcode-cn.com/problems/validate-stack-sequences/                      tip:根据pop序列来倒推push序列是否可能
  2. 题目:https://leetcode-cn.com/problems/01-matrix/                                                 tip:动态规划(四个方向) DFS和BFS(四个方向)可以多总结。
  3. 题目:https://leetcode-cn.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/   tip: 利用中序后序遍历序列的特点,进行递归构建。分好左右子树序列。

Date:2020/4/17

  1. https://leetcode-cn.com/problems/open-the-lock/                                                      tip:双向BFS   BFS模型 
  2. 背包九讲(没咋看透 在加把油!!!)

Date: 2020/4/19

  1. https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/    tip: 与中序和后序一样的思路
  2. https://leetcode-cn.com/problems/queens-that-can-attack-the-king/                                            tip:主要是构造八个方向的数组 思路不难


  3. https://leetcode-cn.com/problems/balance-a-binary-search-tree/submissions/                            tip:我自己重建树,不过应该是AVL树的建立。

Date: 2020/4/20

  1. https://leetcode-cn.com/problems/number-of-islands/                                                        tip:简单的DFS遍历
  2. https://leetcode-cn.com/problems/delete-leaves-with-a-given-value/                                tip:设计到二叉树一般就是递归
  3. https://leetcode-cn.com/problems/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/   tip:简单回溯法

Date: 2020/4/21

  1.https://leetcode-cn.com/problems/max-consecutive-ones-iii/   tip:滑动窗口

  2.https://leetcode-cn.com/problems/minimum-size-subarray-sum/   tip:滑动窗口

  3 https://leetcode-cn.com/problems/count-number-of-nice-subarrays/  tip:滑动窗口

Date: 2020/4/22

  1. https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/    tip:滑动窗口
  2. https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/   tip:滑动窗口
  3. https://leetcode-cn.com/problems/minimum-window-substring/          tip:滑动窗口

Date:2020/4/24

  https://leetcode-cn.com/problems/shu-zu-zhong-de-ni-xu-dui-lcof/   tip:归并排序的应用  下同

  2 https://leetcode-cn.com/problems/count-of-smaller-numbers-after-self/ 

  3 https://leetcode-cn.com/problems/reverse-pairs/

Date:2020/4/25

  1 https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array-ii/    tip:二分  下同  不过细节挺多  卒

  2 https://leetcode-cn.com/problems/search-in-rotated-sorted-array/ 

  3 https://leetcode-cn.com/problems/search-in-rotated-sorted-array-ii/

   4 https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/

Date:2020/4/28

  1 https://leetcode-cn.com/problems/minimum-number-of-steps-to-make-two-strings-anagram/  Tip:map解决  也可以不用直接定义个char[26]更快

  2 https://leetcode-cn.com/problems/lexicographical-numbers/                         Tip:利用map内部自动排序,将数字转成字符串。厉害

  3 https://leetcode-cn.com/problems/find-elements-in-a-contaminated-binary-tree/   Tip:二叉树  一般递归解决

Date:2020/4/29

  1 https://leetcode-cn.com/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/   Tip:两次二分

  2 https://leetcode-cn.com/problems/find-in-mountain-array/                         tip:二分查找分界点,然后在两个区域分别二分

原文地址:https://www.cnblogs.com/SKRWYF/p/12699498.html