I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.
So below I made a list of leetcode problems that are as close to grokking problems as possible.
- https://leetcode-cn.com/problems/maximum-subarray/ # Close enough
- https://leetcode-cn.com/problems/minimum-size-subarray-sum/
- https://leetcode-cn.com/problems/longest-substring-with-at-most-k-distinct-characters/
- https://leetcode-cn.com/problems/fruit-into-baskets/
- https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/
- https://leetcode-cn.com/problems/longest-repeating-character-replacement/
- https://leetcode-cn.com/problems/max-consecutive-ones-iii/
- https://leetcode-cn.com/problems/permutation-in-string/
- https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/
- https://leetcode-cn.com/problems/minimum-window-substring/
- https://leetcode-cn.com/problems/substring-with-concatenation-of-all-words/
- https://leetcode-cn.com/problems/two-sum/
- https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
- https://leetcode-cn.com/problems/squares-of-a-sorted-array/
- https://leetcode-cn.com/problems/3sum/
- https://leetcode-cn.com/problems/3sum-closest/
- https://leetcode-cn.com/problems/3sum-smaller/
- https://leetcode-cn.com/problems/subarray-product-less-than-k/
- https://leetcode-cn.com/problems/sort-colors/
- https://leetcode-cn.com/problems/4sum/
- https://leetcode-cn.com/problems/backspace-string-compare/
- https://leetcode-cn.com/problems/shortest-unsorted-continuous-subarray/
- https://leetcode-cn.com/problems/linked-list-cycle/
- https://leetcode-cn.com/problems/linked-list-cycle-ii/
- https://leetcode-cn.com/problems/happy-number/
- https://leetcode-cn.com/problems/middle-of-the-linked-list/
- https://leetcode-cn.com/problems/palindrome-linked-list/
- https://leetcode-cn.com/problems/reorder-list/
- https://leetcode-cn.com/problems/circular-array-loop/
- https://leetcode-cn.com/problems/merge-intervals/
- https://leetcode-cn.com/problems/insert-interval/
- https://leetcode-cn.com/problems/interval-list-intersections/
- https://leetcode-cn.com/problems/meeting-rooms-ii/
- Could not find equivalent. Given a list of intervals with values, find the peak sum (i.e. if intervals are overlapping, sum their values)
- https://leetcode-cn.com/problems/employee-free-time/
- Couldn't find equivalent for the first question. The second question below encompasses the first one though. See https://leetcode-cn.com/problems/missing-number/discuss/859510/C%2B%2B-O(N)-O(1)-using-Cyclic-Sort for how grokking the coding interview approached these problems. It uses the fact that we can sort the array in O(n) without comparison operators
- https://leetcode-cn.com/problems/missing-number/
- https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array/
- https://leetcode-cn.com/problems/find-all-duplicates-in-an-array/
- combine https://leetcode-cn.com/problems/find-the-duplicate-number/ and https://leetcode-cn.com/problems/missing-number/
- https://leetcode-cn.com/problems/first-missing-positive/
- https://leetcode-cn.com/problems/kth-missing-positive-number/
- https://leetcode-cn.com/problems/reverse-linked-list/
- https://leetcode-cn.com/problems/reverse-linked-list-ii/
- https://leetcode-cn.com/problems/reverse-nodes-in-k-group/
- Next question is the same, but alternate each subgroup
- https://leetcode-cn.com/problems/rotate-list/
- https://leetcode-cn.com/problems/binary-tree-level-order-traversal/
- https://leetcode-cn.com/problems/binary-tree-level-order-traversal-ii/
- https://leetcode-cn.com/problems/binary-tree-zigzag-level-order-traversal/
- https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/
- https://leetcode-cn.com/problems/inorder-successor-in-bst/ # Close, not exact
- https://leetcode-cn.com/problems/populating-next-right-pointers-in-each-node/ # Close, grokk assumes non-perfect tree
- Next question is the same, but connect end nodes to the next level instead of null
- https://leetcode-cn.com/problems/binary-tree-right-side-view/
- https://leetcode-cn.com/problems/path-sum/
- https://leetcode-cn.com/problems/path-sum-ii/
- https://leetcode-cn.com/problems/sum-root-to-leaf-numbers/
- https://leetcode-cn.com/problems/check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree/description/
- https://leetcode-cn.com/problems/path-sum-iii/
- https://leetcode-cn.com/problems/diameter-of-binary-tree/
- https://leetcode-cn.com/problems/binary-tree-maximum-path-sum/
- https://leetcode-cn.com/problems/find-median-from-data-stream/
- https://leetcode-cn.com/problems/sliding-window-median/
- https://leetcode-cn.com/problems/ipo/
- https://leetcode-cn.com/problems/find-right-interval/
- https://leetcode-cn.com/problems/subsets/
- https://leetcode-cn.com/problems/subsets-ii/
- https://leetcode-cn.com/problems/permutations/
- https://leetcode-cn.com/problems/letter-case-permutation/
- https://leetcode-cn.com/problems/generate-parentheses/
- https://leetcode-cn.com/problems/generalized-abbreviation/
- https://leetcode-cn.com/problems/different-ways-to-add-parentheses/
- https://leetcode-cn.com/problems/unique-binary-search-trees-ii/
- https://leetcode-cn.com/problems/unique-binary-search-trees/
- https://leetcode-cn.com/problems/binary-search/ # Close enough. The grokking problem allows sorted input arrays as ascending or descending, which only introduces a simple check
- Did not find. Problem is find index of smallest element greater or equal to input value
- https://leetcode-cn.com/problems/find-smallest-letter-greater-than-target/
- https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/
- https://leetcode-cn.com/problems/search-in-a-sorted-array-of-unknown-size/
- https://leetcode-cn.com/problems/find-k-closest-elements/ (with K == 1)
- https://leetcode-cn.com/problems/peak-index-in-a-mountain-array/
- https://leetcode-cn.com/problems/find-in-mountain-array/
- https://leetcode-cn.com/problems/search-in-rotated-sorted-array/
- Similar to previous, but find the number of rotations of the array.
- https://leetcode-cn.com/problems/single-number/
- https://leetcode-cn.com/problems/single-number-iii/
- https://leetcode-cn.com/problems/complement-of-base-10-integer/
- https://leetcode-cn.com/problems/flipping-an-image/
- Same as second question, but the first Grokking question wants the top K instead of the bottom K
- https://leetcode-cn.com/problems/kth-largest-element-in-an-array
- https://leetcode-cn.com/problems/k-closest-points-to-origin/
- https://leetcode-cn.com/problems/minimum-cost-to-connect-sticks/
- https://leetcode-cn.com/problems/top-k-frequent-elements/
- https://leetcode-cn.com/problems/sort-characters-by-frequency/
- https://leetcode-cn.com/problems/kth-largest-element-in-a-stream/
- https://leetcode-cn.com/problems/find-k-closest-elements/
- https://leetcode-cn.com/problems/least-number-of-unique-integers-after-k-removals/ closest leetcode or https://www.geeksforgeeks.org/maximum-distinct-elements-removing-k-elements/ for exact
- https://www.geeksforgeeks.org/sum-elements-k1th-k2th-smallest-elements/ no leetcode equivalent found
- https://leetcode-cn.com/problems/reorganize-string/
- https://leetcode-cn.com/problems/rearrange-string-k-distance-apart/
- https://leetcode-cn.com/problems/task-scheduler/
- https://leetcode-cn.com/problems/maximum-frequency-stack/
- https://leetcode-cn.com/problems/merge-k-sorted-lists/
- Same as previous, but return the Kth smallest number
- https://leetcode-cn.com/problems/kth-smallest-element-in-a-sorted-matrix/
- https://leetcode-cn.com/problems/smallest-range-covering-elements-from-k-lists/
- https://leetcode-cn.com/problems/find-k-pairs-with-smallest-sums/ small difference, grokking has different sort order and wants the largest
- https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/RM1BDv71V60
- https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/3jEPRo5PDvx or https://leetcode-cn.com/problems/partition-equal-subset-sum/
- https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/3j64vRY6JnR
- https://leetcode-cn.com/problems/last-stone-weight-ii/ similar concept, but problem description is more abstract.
- https://leetcode-cn.com/problems/combination-sum-ii/ similar, but return the number of combinations instead of the combinations
- https://leetcode-cn.com/problems/target-sum/
- BONUS : Not in grokking, but I still found this very useful https://leetcode-cn.com/problems/ones-and-zeroes/
- First problem is identical to the following three
- https://leetcode-cn.com/problems/course-schedule/
- https://leetcode-cn.com/problems/course-schedule-ii/
- Same as above, but return all instead of any
- https://leetcode-cn.com/problems/alien-dictionary/
- https://leetcode-cn.com/problems/sequence-reconstruction/description/
- https://leetcode-cn.com/problems/minimum-height-trees/