contents(algo): split recommended qns into essential vs practice

pull/276/head
Yangshun Tay 3 years ago
parent 87a923079d
commit 016f1250b9

@ -59,6 +59,14 @@ TODO
TODO
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
TODO
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
TODO

@ -112,13 +112,20 @@ If you are given a sequence and the interviewer asks for O(1) space, it might be
This might be obvious, but traversing the array twice/thrice (as long as fewer than n times) is still O(n). Sometimes traversing the array more than once can help you solve the problem while keeping the time complexity to O(n).
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Two Sum](https://leetcode.com/problems/two-sum/)
- [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)
- [Contains Duplicate](https://leetcode.com/problems/contains-duplicate/)
- [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/)
- [Maximum Subarray](https://leetcode.com/problems/maximum-subarray/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Contains Duplicate](https://leetcode.com/problems/contains-duplicate/)
- [Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/)
- [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/)
- [3Sum](https://leetcode.com/problems/3sum/)

@ -55,10 +55,17 @@ Some helpful utility snippets:
| Check if a number is a power of 2 | `(num & num - 1) == 0` or `(num & (-num)) == num` |
| Swapping two variables | `num1 ^= num2; num2 ^= num1; num1 ^= num2` |
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Sum of Two Integers](https://leetcode.com/problems/sum-of-two-integers/)
- [Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Counting Bits](https://leetcode.com/problems/counting-bits/)
- [Missing Number](https://leetcode.com/problems/missing-number/)
- [Reverse Bits](https://leetcode.com/problems/reverse-bits/)

@ -34,16 +34,24 @@ Dynamic Programming (DP) is usually used to solve optimization problems. The onl
Sometimes you do not need to store the whole DP table in memory, the last two values or the last two rows of the matrix will suffice.
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [0/1 Knapsack or Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/)
- [Climbing Stairs](https://leetcode.com/problems/climbing-stairs/)
- [Coin Change](https://leetcode.com/problems/coin-change/)
- [House Robber](https://leetcode.com/problems/house-robber/)
- [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [0/1 Knapsack or Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/)
- [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence/)
- [Word Break Problem](https://leetcode.com/problems/word-break/)
- [Combination Sum](https://leetcode.com/problems/combination-sum-iv/)
- [House Robber](https://leetcode.com/problems/house-robber/) and [House Robber II](https://leetcode.com/problems/house-robber-ii/)
- [House Robber II](https://leetcode.com/problems/house-robber-ii/)
- [Decode Ways](https://leetcode.com/problems/decode-ways/)
- [Unique Paths](https://leetcode.com/problems/unique-paths/)
- [Jump Game](https://leetcode.com/problems/jump-game/)

@ -59,9 +59,16 @@ Here's a [nice visualization](https://silentmatt.com/rectangle-intersection/). E
- Given many points, find k points that are closest to the origin.
- How would you triangulate a polygon?
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Rectangle Overlap](https://leetcode.com/problems/rectangle-overlap/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/)
- [Rectangle Area](https://leetcode.com/problems/rectangle-area/)

@ -192,15 +192,22 @@ print(graph_topo_sort(4, [[0, 1], [0, 2], [2, 1], [3, 0]]))
# [1, 2, 0, 3]
```
## Recommended questions
## Essential questions
- Breadth-first search
_These are essential questions to practice if you're studying for this topic._
- [Number of Islands](https://leetcode.com/problems/number-of-islands/)
- [Flood Fill](https://leetcode.com/problems/flood-fill)
- [01 Matrix](https://leetcode.com/problems/01-matrix/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- Breadth-first search
- [Rotting Oranges](https://leetcode.com/problems/rotting-oranges/)
- [Minimum Knight Moves (LeetCode Premium)](https://leetcode.com/problems/minimum-knight-moves)
- Either search
- [Flood Fill](https://leetcode.com/problems/flood-fill)
- [Number of Islands](https://leetcode.com/problems/number-of-islands/)
- [Clone Graph](https://leetcode.com/problems/clone-graph/)
- [Pacific Atlantic Water Flow](https://leetcode.com/problems/pacific-atlantic-water-flow/)
- [Number of Connected Components in an Undirected Graph (LeetCode Premium)](https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/)

@ -63,10 +63,17 @@ _\* This is the average case, but in interviews we only care about the average c
- Describe an implementation of a least-used cache, and big-O notation of it.
- A question involving an API's integration with hash map where the buckets of hash map are made up of linked lists.
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Two Sum](https://leetcode.com/problems/two-sum)
- [Ransom Note](https://leetcode.com/problems/ransom-note)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Group Anagrams](https://leetcode.com/problems/group-anagrams/)
- [Insert Delete GetRandom O(1)](https://leetcode.com/problems/insert-delete-getrandom-o1/)
- [First Missing Positive](https://leetcode.com/problems/first-missing-positive/)

@ -60,9 +60,17 @@ If you see a top or lowest _k_ being mentioned in the question, it is usually a
If you require the top _k_ elements use a Min Heap of size _k_. Iterate through each element, pushing it into the heap (for python `heapq`, invert the value before pushing to find the max). Whenever the heap size exceeds _k_, remove the minimum element, that will guarantee that you have the _k_ largest elements.
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Merge K Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/)
- [K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/)
- [Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/)

@ -64,10 +64,17 @@ def merge_overlapping_intervals(a, b):
return [min(a[0], b[0]), max(a[1], b[1])]
```
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Merge Intervals](https://leetcode.com/problems/merge-intervals/)
- [Insert Interval](https://leetcode.com/problems/insert-interval/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals/)
- [Meeting Rooms (LeetCode Premium)](https://leetcode.com/problems/meeting-rooms/)
- [Meeting Rooms II (LeetCode Premium)](https://leetcode.com/problems/meeting-rooms-ii/)

@ -120,10 +120,17 @@ Here are some common operations and how they can be achieved easily:
- Swapping values of nodes - Just like arrays, just swap the value of the two nodes, there's no need to swap the `next` pointer
- Combining two lists - attach the head of the second list to the tail of the first list
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Reverse a Linked List](https://leetcode.com/problems/reverse-linked-list/)
- [Detect Cycle in a Linked List](https://leetcode.com/problems/linked-list-cycle/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists/)
- [Merge K Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/)
- [Remove Nth Node From End Of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list/)

@ -60,10 +60,17 @@ If the question asks you to implement an operator such as power, square root or
- Negative numbers
- Floats
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Pow(x, n)](https://leetcode.com/problems/powx-n/)
- [Sqrt(x)](https://leetcode.com/problems/sqrtx/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Integer to English Words](https://leetcode.com/problems/integer-to-english-words/)
## Recommended courses

@ -62,10 +62,17 @@ Transposing a matrix in Python is simply:
transposed_matrix = zip(*matrix)
```
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes/)
- [Spiral Matrix](https://leetcode.com/problems/spiral-matrix/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Rotate Image](https://leetcode.com/problems/rotate-image/)
- [Valid Sudoku](https://leetcode.com/problems/valid-sudoku/)

@ -63,10 +63,17 @@ Most languages don't have a built in Queue class which to be used, and candidate
- Queue with one item
- Queue with two items
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks)
- [Implement Stack using Queues](https://leetcode.com/problems/implement-queue-using-stacks)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks)
- [Design Circular Queue](https://leetcode.com/problems/design-circular-queue)
- [Design Hit Counter (LeetCode Premium)](https://leetcode.com/problems/design-hit-counter)

@ -70,12 +70,19 @@ Many algorithms relevant in coding interviews make heavy use of recursion - bina
In some cases, you may be computing the result for previously computed inputs. Let's look at the Fibonacci example again. `fib(5)` calls `fib(4)` and `fib(3)`, and `fib(4)` calls `fib(3)` and `fib(2)`. `fib(3)` is being called twice! If the value for `fib(3)` is memoized and used again, that greatly improves the efficiency of the algorithm and the time complexity becomes O(n).
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)
- [Generate Parentheses](https://leetcode.com/problems/generate-parentheses/)
- [Combinations](https://leetcode.com/problems/combinations/)
- [Subsets](https://leetcode.com/problems/subsets/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)
- [Subsets II](https://leetcode.com/problems/subsets-ii/)
- [Permutations](https://leetcode.com/problems/permutations/)
- [Sudoku Solver](https://leetcode.com/problems/sudoku-solver/)

@ -83,11 +83,18 @@ When a given sequence is in a sorted order (be it ascending or descending), usin
[Counting sort](https://en.wikipedia.org/wiki/Counting_sort) is a non-comparison-based sort you can use on numbers where you know the range of values beforehand. Examples: [H-Index](https://leetcode.com/problems/h-index/)
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Binary Search](https://leetcode.com/problems/binary-search/)
- [Kth Smallest Element in a Sorted Matrix](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/)
- [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Kth Smallest Element in a Sorted Matrix](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/)
- [Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/)
- [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/)
- [Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/)

@ -63,10 +63,17 @@ Stacks are an important way of supporting nested or recursive function calls and
TODO: Monotonic stacks -->
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Valid Parentheses](https://leetcode.com/problems/valid-parentheses)
- [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Implement Stack using Queues](https://leetcode.com/problems/implement-queue-using-stacks)
- [Min Stack](https://leetcode.com/problems/min-stack)
- [Asteroid Collision](https://leetcode.com/problems/asteroid-collision)

@ -115,11 +115,18 @@ When a question is about counting the number of palindromes, a common trick is t
- For substrings, you can terminate early once there is no match
- For subsequences, use dynamic programming as there are overlapping subproblems. Check out [this question](https://leetcode.com/problems/longest-palindromic-subsequence/)
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Valid Anagram](https://leetcode.com/problems/valid-anagram)
- [Valid Palindrome](https://leetcode.com/problems/valid-palindrome/)
- [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Longest Repeating Character Replacement](https://leetcode.com/problems/longest-repeating-character-replacement/)
- [Find All Anagrams in a String](https://leetcode.com/problems/find-all-anagrams-in-a-string)
- [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/description/)

@ -138,12 +138,22 @@ When you are asked to traverse a tree by level, use breadth-first search.
If the question involves summation of nodes along the way, be sure to check whether nodes can be negative.
## Recommended questions
## Essential questions
- Binary tree
_These are essential questions to practice if you're studying for this topic._
- Binary Tree
- [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/)
- [Same Tree](https://leetcode.com/problems/same-tree/)
- [Invert/Flip Binary Tree](https://leetcode.com/problems/invert-binary-tree/)
- Binary Search Tree
- [Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- Binary tree
- [Same Tree](https://leetcode.com/problems/same-tree/)
- [Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum/)
- [Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)
- [Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/)
@ -152,7 +162,6 @@ If the question involves summation of nodes along the way, be sure to check whet
- [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/)
- [Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/)
- Binary search tree
- [Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/)
- [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/)
- [Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst/)

@ -52,9 +52,16 @@ Be familiar with implementing from scratch, a `Trie` class and its `add`, `remov
Sometimes preprocessing a dictionary of words (given in a list) into a trie, will improve the efficiency of searching for a word of length k, among n words. Searching becomes O(k) instead of O(n).
## Recommended questions
## Essential questions
_These are essential questions to practice if you're studying for this topic._
- [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree)
## Recommended practice questions
_These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._
- [Add and Search Word](https://leetcode.com/problems/add-and-search-word-data-structure-design)
- [Word Break](https://leetcode.com/problems/word-break)
- [Word Search II](https://leetcode.com/problems/word-search-ii/)

@ -17,8 +17,7 @@ sidebar_label: Study and practice plan
<meta property="og:image" content="https://www.techinterviewhandbook.org/social/coding-interview-study-plan.png" />
</head>
import InDocAd from './\_components/InDocAd';
import QuestionList from './\_components/QuestionList';
import InDocAd from './\_components/InDocAd'; import QuestionList from './\_components/QuestionList';
One of the most important questions to answer at the start of your coding interview preparation is: What study topics and practice questions should you do to most efficiently prepare for your coding interviews?
@ -58,7 +57,7 @@ Keep the estimate relatively conservative so you don't end up burning out.
### Week 1 - 4: Topical study + practice
These are all the topics you should study, in order of priority. The learning resources linked are my algorithm cheatsheets - which give you an overview of must-remembers like time complexity, corner cases and topic-specific useful techniques, as well as must-do practice questions.
These are all the topics you should study, in order of priority. The learning resources linked are my algorithm cheatsheets - which give you an overview of must-remembers like time complexity, corner cases, and topic-specific useful techniques, as well as essential and recommended practice questions.
Don't forget to apply behaviors from [coding interview best practices](./coding-interview-cheatsheet.md) and methods from [coding interview techniques](./coding-interview-techniques.md) early on while you practice!
@ -106,10 +105,13 @@ Don't forget to apply behaviors from [coding interview best practices](./coding-
Here, I listed 75 questions that you should do to be fully prepared for your coding interviews. This list of questions are generated from the [**Grind 75 tool**](https://www.techinterviewhandbook.org/grind75/) (built by me), which generates recommended study plans for coding interviews based on the time you have left. More options like filtering by difficulty, topics, alternative grouping of questions can be found there.
Feel free to skip the dynamic programming questions if you haven't studied them or feel that they won't be relevant. Many dynamic programming questions can be solved with recursion / backtracking anyway.
- If you followed the Week 1 - 4 study plan, you would have done some of these questions here. Feel free to skip them or do them again.
- Feel free to skip the dynamic programming questions if you haven't studied them or feel that they won't be relevant. Many dynamic programming questions can be solved with recursion / backtracking anyway.
Don't forget to apply behaviors from [coding interview best practices](./coding-interview-cheatsheet.md) and methods from [coding interview techniques](./coding-interview-techniques.md) early on while you practice!
We recommend using the [**Grind 75**](https://www.techinterviewhandbook.org/grind75/) tool which allows you to keep track of your practice progress.
<QuestionList />
## Factor time for your self introduction, final questions and mock coding interviews

Loading…
Cancel
Save