Open
Description
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):
- Task's order is fixed, find the last task finished time
- What if Tasks' quantities are way larger than the cooldown time (Scan Task)
- 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
Metadata
Metadata
Assignees
Labels
No labels