-
-
Save kevinseo16/66a1af5087fd041e472bf145e1cc593b to your computer and use it in GitHub Desktop.
Revisions
-
kevinseo16 revised this gist
Oct 17, 2022 . 1 changed file with 3 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ ## Pattern 3: Two Pointers * https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/ * https://leetcode.com/problems/remove-duplicates-from-sorted-array/ * https://leetcode.com/problems/squares-of-a-sorted-array/ * https://leetcode.com/problems/3sum/ @@ -51,6 +51,7 @@ * https://leetcode.com/problems/merge-intervals/ * https://leetcode.com/problems/insert-interval/ * https://leetcode.com/problems/interval-list-intersections/ * https://leetcode.com/problems/meeting-rooms/ * https://leetcode.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.com/problems/employee-free-time/ @@ -175,7 +176,4 @@ * Same as above, but return all instead of any * https://leetcode.com/problems/alien-dictionary/ * https://leetcode.com/problems/sequence-reconstruction/description/ * https://leetcode.com/problems/minimum-height-trees/ -
kevinseo16 revised this gist
Oct 17, 2022 . 1 changed file with 38 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,4 @@ ## Pattern 1: Sliding Window * https://leetcode.com/problems/maximum-subarray/ # Close enough * https://leetcode.com/problems/minimum-size-subarray-sum/ @@ -18,7 +12,17 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/minimum-window-substring/ * https://leetcode.com/problems/substring-with-concatenation-of-all-words/ ## Pattern 2: Islands (Matrix Traversal) * number of islands https://leetcode.com/problems/number-of-islands/ * biggest island https://leetcode.com/problems/max-area-of-island/ * flood fill https://leetcode.com/problems/flood-fill/ * number of closed islands https://leetcode.com/problems/number-of-closed-islands/ * problem challenge 1 https://leetcode.com/problems/island-perimeter/ * problem challenge 2 https://leetcode.com/problems/number-of-distinct-islands/ * problem challenge 3 https://leetcode.com/problems/detect-cycles-in-2d-grid/ ## Pattern 3: Two Pointers * https://leetcode.com/problems/two-sum/ * https://leetcode.com/problems/remove-duplicates-from-sorted-array/ @@ -32,7 +36,8 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/backspace-string-compare/ * https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ ## Pattern 4: Fast & Slow pointers * https://leetcode.com/problems/linked-list-cycle/ * https://leetcode.com/problems/linked-list-cycle-ii/ * https://leetcode.com/problems/happy-number/ @@ -41,15 +46,16 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/reorder-list/ * https://leetcode.com/problems/circular-array-loop/ ## Pattern 5: Merge Intervals * https://leetcode.com/problems/merge-intervals/ * https://leetcode.com/problems/insert-interval/ * https://leetcode.com/problems/interval-list-intersections/ * https://leetcode.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.com/problems/employee-free-time/ ## Pattern 6 : Cyclic Sort * Couldn't find equivalent for the first question. The second question below encompasses the first one though. See https://leetcode.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.com/problems/missing-number/ @@ -59,14 +65,16 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/first-missing-positive/ * https://leetcode.com/problems/kth-missing-positive-number/ ## Pattern 7: In-place Reversal of a LinkedList * https://leetcode.com/problems/reverse-linked-list/ * https://leetcode.com/problems/reverse-linked-list-ii/ * https://leetcode.com/problems/reverse-nodes-in-k-group/ * Next question is the same, but alternate each subgroup * https://leetcode.com/problems/rotate-list/ ## Pattern 8: Tree Breadth First Search * https://leetcode.com/problems/binary-tree-level-order-traversal/ * https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ * https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ @@ -76,7 +84,8 @@ So below I made a list of leetcode problems that are as close to grokking proble * Next question is the same, but connect end nodes to the next level instead of null * https://leetcode.com/problems/binary-tree-right-side-view/ ## Pattern 9: Tree Depth First Search * https://leetcode.com/problems/path-sum/ * https://leetcode.com/problems/path-sum-ii/ * https://leetcode.com/problems/sum-root-to-leaf-numbers/ @@ -85,13 +94,15 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/diameter-of-binary-tree/ * https://leetcode.com/problems/binary-tree-maximum-path-sum/ ## Pattern 10: Two Heaps * https://leetcode.com/problems/find-median-from-data-stream/ * https://leetcode.com/problems/sliding-window-median/ * https://leetcode.com/problems/ipo/ * https://leetcode.com/problems/find-right-interval/ ## Pattern 11: Subsets * https://leetcode.com/problems/subsets/ * https://leetcode.com/problems/subsets-ii/ * https://leetcode.com/problems/permutations/ @@ -102,7 +113,8 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/unique-binary-search-trees-ii/ * https://leetcode.com/problems/unique-binary-search-trees/ ## Pattern 12: Modified Binary Search * https://leetcode.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.com/problems/find-smallest-letter-greater-than-target/ @@ -114,13 +126,14 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/search-in-rotated-sorted-array/ * Similar to previous, but find the number of rotations of the array. ## Pattern 13: Bitwise XOR * https://leetcode.com/problems/single-number/ * https://leetcode.com/problems/single-number-iii/ * https://leetcode.com/problems/complement-of-base-10-integer/ * https://leetcode.com/problems/flipping-an-image/ ## Pattern 14: Top 'K' elements * Same as second question, but the first Grokking question wants the top K instead of the bottom K * https://leetcode.com/problems/kth-largest-element-in-an-array * https://leetcode.com/problems/k-closest-points-to-origin/ @@ -136,14 +149,16 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/task-scheduler/ * https://leetcode.com/problems/maximum-frequency-stack/ ## Pattern 15: K-way merge * https://leetcode.com/problems/merge-k-sorted-lists/ * Same as previous, but return the Kth smallest number * https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/ * https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists/ * https://leetcode.com/problems/find-k-pairs-with-smallest-sums/ small difference, grokking has different sort order and wants the largest ## Pattern 16: 0/1 Knapsack * 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.com/problems/partition-equal-subset-sum/ * https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/3j64vRY6JnR @@ -152,7 +167,8 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/target-sum/ * BONUS : Not in grokking, but I still found this very useful https://leetcode.com/problems/ones-and-zeroes/ ## Pattern 17: Topological Sort * First problem is identical to the following three * https://leetcode.com/problems/course-schedule/ * https://leetcode.com/problems/course-schedule-ii/ -
kevinseo16 revised this gist
Oct 17, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ I liked the way Grokking the coding interview organized problems into learnable So below I made a list of leetcode problems that are as close to grokking problems as possible. ## Pattern: 1 Sliding Window * https://leetcode.com/problems/maximum-subarray/ # Close enough * https://leetcode.com/problems/minimum-size-subarray-sum/ @@ -18,7 +18,7 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/minimum-window-substring/ * https://leetcode.com/problems/substring-with-concatenation-of-all-words/ ## Pattern 2: Two Pointers * https://leetcode.com/problems/two-sum/ * https://leetcode.com/problems/remove-duplicates-from-sorted-array/ -
tykurtz revised this gist
Nov 29, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -148,7 +148,7 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/3jEPRo5PDvx or https://leetcode.com/problems/partition-equal-subset-sum/ * https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/3j64vRY6JnR * https://leetcode.com/problems/last-stone-weight-ii/ similar concept, but problem description is more abstract. * https://leetcode.com/problems/combination-sum-ii/ similar, but return the number of combinations instead of the combinations * https://leetcode.com/problems/target-sum/ * BONUS : Not in grokking, but I still found this very useful https://leetcode.com/problems/ones-and-zeroes/ -
tykurtz revised this gist
Nov 27, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -150,6 +150,7 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/last-stone-weight-ii/ similar concept, but problem description is more abstract. * https://leetcode.com/problems/combination-sum-ii/ close enough * https://leetcode.com/problems/target-sum/ * BONUS : Not in grokking, but I still found this very useful https://leetcode.com/problems/ones-and-zeroes/ ## Pattern: Topological Sort * First problem is identical to the following three -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -137,7 +137,12 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/maximum-frequency-stack/ ## Pattern: K-way merge * https://leetcode.com/problems/merge-k-sorted-lists/ * Same as previous, but return the Kth smallest number * https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/ * https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists/ * https://leetcode.com/problems/find-k-pairs-with-smallest-sums/ small difference, grokking has different sort order and wants the largest ## Pattern: 0/1 Knapsack * 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.com/problems/partition-equal-subset-sum/ -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 15 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -121,7 +121,21 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/flipping-an-image/ ## Pattern: Top 'K' elements * Same as second question, but the first Grokking question wants the top K instead of the bottom K * https://leetcode.com/problems/kth-largest-element-in-an-array * https://leetcode.com/problems/k-closest-points-to-origin/ * https://leetcode.com/problems/minimum-cost-to-connect-sticks/ * https://leetcode.com/problems/top-k-frequent-elements/ * https://leetcode.com/problems/sort-characters-by-frequency/ * https://leetcode.com/problems/kth-largest-element-in-a-stream/ * https://leetcode.com/problems/find-k-closest-elements/ * https://leetcode.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.com/problems/reorganize-string/ * https://leetcode.com/problems/rearrange-string-k-distance-apart/ * https://leetcode.com/problems/task-scheduler/ * https://leetcode.com/problems/maximum-frequency-stack/ ## Pattern: K-way merge todo ## Pattern: 0/1 Knapsack -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -125,7 +125,13 @@ todo ## Pattern: K-way merge todo ## Pattern: 0/1 Knapsack * 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.com/problems/partition-equal-subset-sum/ * https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/3j64vRY6JnR * https://leetcode.com/problems/last-stone-weight-ii/ similar concept, but problem description is more abstract. * https://leetcode.com/problems/combination-sum-ii/ close enough * https://leetcode.com/problems/target-sum/ ## Pattern: Topological Sort * First problem is identical to the following three * https://leetcode.com/problems/course-schedule/ -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -115,9 +115,25 @@ So below I made a list of leetcode problems that are as close to grokking proble * Similar to previous, but find the number of rotations of the array. ## Pattern: Bitwise XOR * https://leetcode.com/problems/single-number/ * https://leetcode.com/problems/single-number-iii/ * https://leetcode.com/problems/complement-of-base-10-integer/ * https://leetcode.com/problems/flipping-an-image/ ## Pattern: Top 'K' elements todo ## Pattern: K-way merge todo ## Pattern: 0/1 Knapsack todo ## Pattern: Topological Sort * First problem is identical to the following three * https://leetcode.com/problems/course-schedule/ * https://leetcode.com/problems/course-schedule-ii/ * Same as above, but return all instead of any * https://leetcode.com/problems/alien-dictionary/ * https://leetcode.com/problems/sequence-reconstruction/description/ * https://leetcode.com/problems/minimum-height-trees/ ## Misc * https://leetcode.com/problems/kth-largest-element-in-an-array/ -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -103,6 +103,16 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/unique-binary-search-trees/ ## Pattern: Modified Binary Search * https://leetcode.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.com/problems/find-smallest-letter-greater-than-target/ * https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ * https://leetcode.com/problems/search-in-a-sorted-array-of-unknown-size/ * https://leetcode.com/problems/find-k-closest-elements/ (with K == 1) * https://leetcode.com/problems/peak-index-in-a-mountain-array/ * https://leetcode.com/problems/find-in-mountain-array/ * https://leetcode.com/problems/search-in-rotated-sorted-array/ * Similar to previous, but find the number of rotations of the array. ## Pattern: Bitwise XOR ## Pattern: Top 'K' elements -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 24 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,9 +77,33 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/binary-tree-right-side-view/ ## Pattern: Tree Depth First Search * https://leetcode.com/problems/path-sum/ * https://leetcode.com/problems/path-sum-ii/ * https://leetcode.com/problems/sum-root-to-leaf-numbers/ * https://leetcode.com/problems/check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree/description/ * https://leetcode.com/problems/path-sum-iii/ * https://leetcode.com/problems/diameter-of-binary-tree/ * https://leetcode.com/problems/binary-tree-maximum-path-sum/ ## Pattern: Two Heaps * https://leetcode.com/problems/find-median-from-data-stream/ * https://leetcode.com/problems/sliding-window-median/ * https://leetcode.com/problems/ipo/ * https://leetcode.com/problems/find-right-interval/ ## Pattern: Subsets * https://leetcode.com/problems/subsets/ * https://leetcode.com/problems/subsets-ii/ * https://leetcode.com/problems/permutations/ * https://leetcode.com/problems/letter-case-permutation/ * https://leetcode.com/problems/generate-parentheses/ * https://leetcode.com/problems/generalized-abbreviation/ * https://leetcode.com/problems/different-ways-to-add-parentheses/ * https://leetcode.com/problems/unique-binary-search-trees-ii/ * https://leetcode.com/problems/unique-binary-search-trees/ ## Pattern: Modified Binary Search ## Pattern: Bitwise XOR ## Pattern: Top 'K' elements ## Pattern: K-way merge -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,14 +76,14 @@ So below I made a list of leetcode problems that are as close to grokking proble * Next question is the same, but connect end nodes to the next level instead of null * https://leetcode.com/problems/binary-tree-right-side-view/ ## Pattern: Tree Depth First Search ## Pattern: Two Heaps ## Pattern: Subsets ## Pattern: Modified Binary Search ## Pattern: Bitwise XOR ## Pattern: Top 'K' elements ## Pattern: K-way merge ## Pattern: 0/1 Knapsack ## Pattern: Topological Sort ## Misc * https://leetcode.com/problems/kth-largest-element-in-an-array/ -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ # GROKKING NOTES 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. ## Pattern: Sliding Window * https://leetcode.com/problems/maximum-subarray/ # Close enough * https://leetcode.com/problems/minimum-size-subarray-sum/ @@ -18,7 +18,7 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/minimum-window-substring/ * https://leetcode.com/problems/substring-with-concatenation-of-all-words/ ## Pattern: Two Pointers * https://leetcode.com/problems/two-sum/ * https://leetcode.com/problems/remove-duplicates-from-sorted-array/ @@ -32,7 +32,7 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/backspace-string-compare/ * https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ ## Pattern: Fast & Slow pointers * https://leetcode.com/problems/linked-list-cycle/ * https://leetcode.com/problems/linked-list-cycle-ii/ * https://leetcode.com/problems/happy-number/ @@ -41,15 +41,15 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/reorder-list/ * https://leetcode.com/problems/circular-array-loop/ ## Pattern: Merge Intervals * https://leetcode.com/problems/merge-intervals/ * https://leetcode.com/problems/insert-interval/ * https://leetcode.com/problems/interval-list-intersections/ * https://leetcode.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.com/problems/employee-free-time/ ## Pattern: Cyclic Sort * Couldn't find equivalent for the first question. The second question below encompasses the first one though. See https://leetcode.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.com/problems/missing-number/ @@ -59,14 +59,14 @@ So below I made a list of leetcode problems that are as close to grokking proble * https://leetcode.com/problems/first-missing-positive/ * https://leetcode.com/problems/kth-missing-positive-number/ ## Pattern: In-place Reversal of a LinkedList * https://leetcode.com/problems/reverse-linked-list/ * https://leetcode.com/problems/reverse-linked-list-ii/ * https://leetcode.com/problems/reverse-nodes-in-k-group/ * Next question is the same, but alternate each subgroup * https://leetcode.com/problems/rotate-list/ ## Pattern: Tree Breadth First Search * https://leetcode.com/problems/binary-tree-level-order-traversal/ * https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ * https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 55 additions and 109 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,129 +6,75 @@ So below I made a list of leetcode problems that are as close to grokking proble 1. Pattern: Sliding Window * https://leetcode.com/problems/maximum-subarray/ # Close enough * https://leetcode.com/problems/minimum-size-subarray-sum/ * https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/ * https://leetcode.com/problems/fruit-into-baskets/ * https://leetcode.com/problems/longest-substring-without-repeating-characters/ * https://leetcode.com/problems/longest-repeating-character-replacement/ * https://leetcode.com/problems/max-consecutive-ones-iii/ * https://leetcode.com/problems/permutation-in-string/ * https://leetcode.com/problems/find-all-anagrams-in-a-string/ * https://leetcode.com/problems/minimum-window-substring/ * https://leetcode.com/problems/substring-with-concatenation-of-all-words/ 2. Pattern: Two Pointers * https://leetcode.com/problems/two-sum/ * https://leetcode.com/problems/remove-duplicates-from-sorted-array/ * https://leetcode.com/problems/squares-of-a-sorted-array/ * https://leetcode.com/problems/3sum/ * https://leetcode.com/problems/3sum-closest/ * https://leetcode.com/problems/3sum-smaller/ * https://leetcode.com/problems/subarray-product-less-than-k/ * https://leetcode.com/problems/sort-colors/ * https://leetcode.com/problems/4sum/ * https://leetcode.com/problems/backspace-string-compare/ * https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ 3. Pattern: Fast & Slow pointers * https://leetcode.com/problems/linked-list-cycle/ * https://leetcode.com/problems/linked-list-cycle-ii/ * https://leetcode.com/problems/happy-number/ * https://leetcode.com/problems/middle-of-the-linked-list/ * https://leetcode.com/problems/palindrome-linked-list/ * https://leetcode.com/problems/reorder-list/ * https://leetcode.com/problems/circular-array-loop/ 4. Pattern: Merge Intervals * https://leetcode.com/problems/merge-intervals/ * https://leetcode.com/problems/insert-interval/ * https://leetcode.com/problems/interval-list-intersections/ * https://leetcode.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.com/problems/employee-free-time/ 5. Pattern: Cyclic Sort * Couldn't find equivalent for the first question. The second question below encompasses the first one though. See https://leetcode.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.com/problems/missing-number/ * https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ * https://leetcode.com/problems/find-all-duplicates-in-an-array/ * combine https://leetcode.com/problems/find-the-duplicate-number/ and https://leetcode.com/problems/missing-number/ * https://leetcode.com/problems/first-missing-positive/ * https://leetcode.com/problems/kth-missing-positive-number/ 6. Pattern: In-place Reversal of a LinkedList * https://leetcode.com/problems/reverse-linked-list/ * https://leetcode.com/problems/reverse-linked-list-ii/ * https://leetcode.com/problems/reverse-nodes-in-k-group/ * Next question is the same, but alternate each subgroup * https://leetcode.com/problems/rotate-list/ 7. Pattern: Tree Breadth First Search * https://leetcode.com/problems/binary-tree-level-order-traversal/ * https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ * https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ * https://leetcode.com/problems/minimum-depth-of-binary-tree/ * https://leetcode.com/problems/inorder-successor-in-bst/ # Close, not exact * https://leetcode.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.com/problems/binary-tree-right-side-view/ 8. Pattern: Tree Depth First Search 9. Pattern: Two Heaps -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 12 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ I liked the way Grokking the coding interview organized problems into learnable So below I made a list of leetcode problems that are as close to grokking problems as possible. 1. Pattern: Sliding Window https://leetcode.com/problems/maximum-subarray/ # Close enough https://leetcode.com/problems/minimum-size-subarray-sum/ @@ -28,6 +29,7 @@ https://leetcode.com/problems/minimum-window-substring/ https://leetcode.com/problems/substring-with-concatenation-of-all-words/ 2. Pattern: Two Pointers https://leetcode.com/problems/two-sum/ https://leetcode.com/problems/remove-duplicates-from-sorted-array/ @@ -51,6 +53,7 @@ https://leetcode.com/problems/backspace-string-compare/ https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ 3. Pattern: Fast & Slow pointers https://leetcode.com/problems/linked-list-cycle/ https://leetcode.com/problems/linked-list-cycle-ii/ @@ -66,6 +69,7 @@ https://leetcode.com/problems/reorder-list/ https://leetcode.com/problems/circular-array-loop/ 4. Pattern: Merge Intervals https://leetcode.com/problems/merge-intervals/ https://leetcode.com/problems/insert-interval/ @@ -74,15 +78,16 @@ https://leetcode.com/problems/interval-list-intersections/ https://leetcode.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.com/problems/employee-free-time/ 5. Pattern: Cyclic Sort Couldn't find equivalent for the first question. The second question below encompasses the first one though. See https://leetcode.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.com/problems/missing-number/ https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ @@ -103,7 +108,7 @@ https://leetcode.com/problems/reverse-linked-list-ii/ https://leetcode.com/problems/reverse-nodes-in-k-group/ Next question is the same, but alternate each subgroup https://leetcode.com/problems/rotate-list/ @@ -121,7 +126,7 @@ https://leetcode.com/problems/inorder-successor-in-bst/ # Close, not exact https://leetcode.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.com/problems/binary-tree-right-side-view/ -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 49 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,45 +6,76 @@ So below I made a list of leetcode problems that are as close to grokking proble 1. Pattern: Sliding Window https://leetcode.com/problems/maximum-subarray/ # Close enough https://leetcode.com/problems/minimum-size-subarray-sum/ https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/ https://leetcode.com/problems/fruit-into-baskets/ https://leetcode.com/problems/longest-substring-without-repeating-characters/ https://leetcode.com/problems/longest-repeating-character-replacement/ https://leetcode.com/problems/max-consecutive-ones-iii/ https://leetcode.com/problems/permutation-in-string/ https://leetcode.com/problems/find-all-anagrams-in-a-string/ https://leetcode.com/problems/minimum-window-substring/ https://leetcode.com/problems/substring-with-concatenation-of-all-words/ 2. Pattern: Two Pointers https://leetcode.com/problems/two-sum/ https://leetcode.com/problems/remove-duplicates-from-sorted-array/ https://leetcode.com/problems/squares-of-a-sorted-array/ https://leetcode.com/problems/3sum/ https://leetcode.com/problems/3sum-closest/ https://leetcode.com/problems/3sum-smaller/ https://leetcode.com/problems/subarray-product-less-than-k/ https://leetcode.com/problems/sort-colors/ https://leetcode.com/problems/4sum/ https://leetcode.com/problems/backspace-string-compare/ https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ 3. Pattern: Fast & Slow pointers https://leetcode.com/problems/linked-list-cycle/ https://leetcode.com/problems/linked-list-cycle-ii/ https://leetcode.com/problems/happy-number/ https://leetcode.com/problems/middle-of-the-linked-list/ https://leetcode.com/problems/palindrome-linked-list/ https://leetcode.com/problems/reorder-list/ https://leetcode.com/problems/circular-array-loop/ 4. Pattern: Merge Intervals https://leetcode.com/problems/merge-intervals/ https://leetcode.com/problems/insert-interval/ https://leetcode.com/problems/interval-list-intersections/ https://leetcode.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.com/problems/employee-free-time/ 5. Pattern: Cyclic Sort @@ -53,27 +84,45 @@ https://leetcode.com/problems/employee-free-time/ # 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.com/problems/missing-number/ https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ https://leetcode.com/problems/find-all-duplicates-in-an-array/ combine https://leetcode.com/problems/find-the-duplicate-number/ and https://leetcode.com/problems/missing-number/ https://leetcode.com/problems/first-missing-positive/ https://leetcode.com/problems/kth-missing-positive-number/ 6. Pattern: In-place Reversal of a LinkedList https://leetcode.com/problems/reverse-linked-list/ https://leetcode.com/problems/reverse-linked-list-ii/ https://leetcode.com/problems/reverse-nodes-in-k-group/ # Next question is the same, but alternate each subgroup https://leetcode.com/problems/rotate-list/ 7. Pattern: Tree Breadth First Search https://leetcode.com/problems/binary-tree-level-order-traversal/ https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ https://leetcode.com/problems/minimum-depth-of-binary-tree/ https://leetcode.com/problems/inorder-successor-in-bst/ # Close, not exact https://leetcode.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.com/problems/binary-tree-right-side-view/ 8. Pattern: Tree Depth First Search -
tykurtz revised this gist
Oct 26, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ ****GROKKING NOTES**** 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. -
tykurtz created this gist
Oct 26, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,88 @@ ****GROKKING NOTES***** 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. 1. Pattern: Sliding Window https://leetcode.com/problems/maximum-subarray/ # Close enough https://leetcode.com/problems/minimum-size-subarray-sum/ https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/ https://leetcode.com/problems/fruit-into-baskets/ https://leetcode.com/problems/longest-substring-without-repeating-characters/ https://leetcode.com/problems/longest-repeating-character-replacement/ https://leetcode.com/problems/max-consecutive-ones-iii/ https://leetcode.com/problems/permutation-in-string/ https://leetcode.com/problems/find-all-anagrams-in-a-string/ https://leetcode.com/problems/minimum-window-substring/ https://leetcode.com/problems/substring-with-concatenation-of-all-words/ 2. Pattern: Two Pointers https://leetcode.com/problems/two-sum/ https://leetcode.com/problems/remove-duplicates-from-sorted-array/ https://leetcode.com/problems/squares-of-a-sorted-array/ https://leetcode.com/problems/3sum/ https://leetcode.com/problems/3sum-closest/ https://leetcode.com/problems/3sum-smaller/ https://leetcode.com/problems/subarray-product-less-than-k/ https://leetcode.com/problems/sort-colors/ https://leetcode.com/problems/4sum/ https://leetcode.com/problems/backspace-string-compare/ https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ 3. Pattern: Fast & Slow pointers https://leetcode.com/problems/linked-list-cycle/ https://leetcode.com/problems/linked-list-cycle-ii/ https://leetcode.com/problems/happy-number/ https://leetcode.com/problems/middle-of-the-linked-list/ https://leetcode.com/problems/palindrome-linked-list/ https://leetcode.com/problems/reorder-list/ https://leetcode.com/problems/circular-array-loop/ 4. Pattern: Merge Intervals https://leetcode.com/problems/merge-intervals/ https://leetcode.com/problems/insert-interval/ https://leetcode.com/problems/interval-list-intersections/ https://leetcode.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.com/problems/employee-free-time/ 5. Pattern: Cyclic Sort # Couldn't find equivalent for the first question. The second question below encompasses the first one though. # See https://leetcode.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.com/problems/missing-number/ https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ https://leetcode.com/problems/find-all-duplicates-in-an-array/ combine https://leetcode.com/problems/find-the-duplicate-number/ and https://leetcode.com/problems/missing-number/ https://leetcode.com/problems/first-missing-positive/ https://leetcode.com/problems/kth-missing-positive-number/ 6. Pattern: In-place Reversal of a LinkedList https://leetcode.com/problems/reverse-linked-list/ https://leetcode.com/problems/reverse-linked-list-ii/ https://leetcode.com/problems/reverse-nodes-in-k-group/ # Next question is the same, but alternate each subgroup https://leetcode.com/problems/rotate-list/ 7. Pattern: Tree Breadth First Search https://leetcode.com/problems/binary-tree-level-order-traversal/ https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ https://leetcode.com/problems/minimum-depth-of-binary-tree/ https://leetcode.com/problems/inorder-successor-in-bst/ # Close, not exact https://leetcode.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.com/problems/binary-tree-right-side-view/ 8. Pattern: Tree Depth First Search 9. Pattern: Two Heaps 10. Pattern: Subsets 11. Pattern: Modified Binary Search 12. Pattern: Bitwise XOR 13. Pattern: Top 'K' elements 14. Pattern: K-way merge 15. Pattern: 0/1 Knapsack 16. Pattern: Topological Sort 17. https://leetcode.com/problems/kth-largest-element-in-an-array/