leetcode icon indicating copy to clipboard operation
leetcode copied to clipboard

[Weekly Plan] Day 7 - 12. (New Start) | 2/18 - 2/22

Open tech-cow opened this issue 5 years ago • 6 comments

Week 2 | Day 1

Goal

  • Focus on High Freq Qs

560. Subarray Sum Equals K (x7)

  • [ ] 560. Subarray Sum Equals K

Variation Non-negative # using sliding window.


301. Remove Invalid Parentheses (X8)

  • [ ] 301. Remove Invalid Parentheses

Return only one solution

  • [ ] 20. Valid Parentheses
  • [ ] 921. Minimum Add to Make Parentheses Valid
  • [ ] 32. Longest Valid Parentheses
  • [ ] 1249. Minimum Remove to Make Valid Parentheses

  • [ ] 98. Validate Binary Search Tree (x5)
  • [ ] 269 Alien Dictionary (x3)
  • [ ] 133 Clone Graph (x2)
  • [ ] 76. Minimum Window Substring (x2)
  • [ ] 953. Verifying an Alien Dictionary (x2)

621 Task Scheduler (x2)

  • [ ] 621 Task Scheduler

Variation (English):

  1. Task's order is fixed, find the last task finished time
  2. What if Tasks' quantities are way larger than the cooldown time (Scan Task)
  3. What if the cooldown time is way larger than the tasks' quantities (Queue + Sliding Window)

Variation (Chinese): 给的是task顺利固定,要求最后一个task完成的时间。用hashmap记录一下上一个相同task的完成时间,然后和cool down time比较一下就可以了。follow up是更加优化一下空间,我说的是如果一个task执行完之后,时间过了cool down time就可以把它从map里面remove掉了,没有要写出来。每一题都问了复杂度。 近期高频,两个follow up: task个数远大与cooldown ===》 scan task cooldown远大与task个数 ===》 queue with sliding window

tech-cow avatar Feb 18 '20 19:02 tech-cow

Week 2 | Day 2

Goal

  • Focus on High Freq Qs

Leetcode

29. Divide Two Integers (x3)

  • [ ] 29. Divide Two Integers

Pathrise: Divide without Divide or Mod (x2) https://docs.google.com/document/u/1/d/1v69L_OUGAIFpWZ1SiswqTo3KmlbAf8GiR0T4yz7oTkY/edit

65. Divide Two Integers (x3)

  • [ ] 65. Valid Number (x2)

简化:只需要判断符号和小数,其他全部不用判断,比如首尾空格和e之类的 https://leetcode.com/problems/valid-number/ https://leetcode.com/problems/valid-number/discuss/23728/A-simple-solution-in-Python-based-on-DFA

  • [ ] 42 Trapping Rain Water (x2)
  • [ ] 11. Container With Most Water
  • [ ] 973 K Closest Points to Origin (Quick Select) (x2)
  • [ ] 211. Add and Search Word - Data Structure Design (x2)
  • [ ] 3. Longest Substring Without Repeating Characters (x2)
  • [ ] 297. Serialize and Deserialize Binary Tree (x4)

tech-cow avatar Feb 18 '20 19:02 tech-cow

Week 2 | Day 3

Goal

  • Focus on High Freq Qs

Leetcode

  • [ ] Next Permutation (x2)
  • [ ] 426. Convert Binary Search Tree to Sorted Doubly Linked List (x2)
  • [ ] 54 Spiral Matrix (x2)
  • [ ] 59 Spiral Matrix II
  • [ ] 885 Spiral Matrix III
  • [ ] 207 Course Schedule (x2)
  • [ ] 158. Read N Characters Given Read4 II - Call multiple times

@158 Clean up code @885 Figure out the time complexity

tech-cow avatar Feb 18 '20 19:02 tech-cow

Week 2 | Day 4

Goal

  • All Trees

Leetcode

  • [ ] 230. Kth Smallest Element in a BST
    • 如果n是已知的一个不变的数字,能否略过某些步骤?
    • 如果树是满的,能否略过某些步骤?
  • [ ] 865 Smallest Subtree with all the Deepest Nodes
  • [ ] 173. Binary Search Tree Iterator
    • 对于pre-order和in-order顺序,分别实现hasNext()和next()方法
  • [ ] 102. Binary Tree Level Order Traversal
  • [ ] 285 Inorder Successor in BST
  • [ ] 226 Invert Binary Tree
  • [ ] 297. Serialize and Deserialize Binary Tree
  • [ ] 236. Lowest Common Ancestor of a Binary Tree

tech-cow avatar Feb 18 '20 19:02 tech-cow

Week 2 | Day 5

Goal

  • All Graph

Leetcode

  • Regular
    • [ ] 133. Clone Graph
      • What about Directed Graph?
  • Matrix
    • [ ] 417. Pacific Atlantic Water Flow
    • [ ] 329 Longest Increasing Path in a Matrix
    • [ ] 489. Robot Room Cleaner
  • Topological Sort
    • [ ] 269. Alien Dictionary
    • [ ] 207. Course Schedule

tech-cow avatar Feb 18 '20 19:02 tech-cow

Week 2 | Day 6

Goal

DFS / Backtracking

Leetcode

  • [x] 301 Remove Invalid Parentheses
  • [x] 78. Subsets
  • [x] 567. Permutation in String
  • [x] 79. Word Search
    • Could Trie improves Speed?
  • [x] 126 Word Ladder II
  • [x] 721. Accounts Merge
  • [ ] 10. Regular Expression Matching
    • 变种 regex变成“+”,“*”(我的妈,上来我一看题就知道要挂...我用dp写的,但是天竺小哥说最好用recursion..)

tech-cow avatar Feb 18 '20 19:02 tech-cow

sliding window problems: 76,438, 567

tech-cow avatar Feb 26 '20 17:02 tech-cow