{"id":19876061,"url":"https://github.com/davidf1000/grokking-leetcode","last_synced_at":"2025-10-17T04:51:21.610Z","repository":{"id":124918205,"uuid":"511616363","full_name":"davidf1000/grokking-leetcode","owner":"davidf1000","description":"Archive code for Grokking the Coding Interview course's problem solutions by finding relatively similar question from leetcode ","archived":false,"fork":false,"pushed_at":"2022-07-08T10:21:33.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T01:41:20.400Z","etag":null,"topics":["dsa","leetcode","python"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidf1000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-07T17:23:20.000Z","updated_at":"2022-07-16T14:39:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"692ee111-0303-42bc-9fc6-b8728dbf9f10","html_url":"https://github.com/davidf1000/grokking-leetcode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidf1000/grokking-leetcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidf1000%2Fgrokking-leetcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidf1000%2Fgrokking-leetcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidf1000%2Fgrokking-leetcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidf1000%2Fgrokking-leetcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidf1000","download_url":"https://codeload.github.com/davidf1000/grokking-leetcode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidf1000%2Fgrokking-leetcode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273403857,"owners_count":25099299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsa","leetcode","python"],"created_at":"2024-11-12T16:30:26.140Z","updated_at":"2025-10-17T04:51:21.499Z","avatar_url":"https://github.com/davidf1000.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# grokking-leetcode\nArchive code for Grokking the Coding Interview course's problem solutions by finding relatively similar question from leetcode \n\nThe Grokking course : \nhttps://www.educative.io/courses/grokking-the-coding-interview\n\n\n# List of Problems \n\n(Curated from https://gist.github.com/tykurtz/3548a31f673588c05c89f9ca42067bc4 )\n\n## Pattern: Sliding Window\n\n* https://leetcode.com/problems/maximum-subarray/ # Close enough\n* https://leetcode.com/problems/minimum-size-subarray-sum/\n* https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/\n* https://leetcode.com/problems/fruit-into-baskets/\n* https://leetcode.com/problems/longest-substring-without-repeating-characters/\n* https://leetcode.com/problems/longest-repeating-character-replacement/\n* https://leetcode.com/problems/max-consecutive-ones-iii/\n* https://leetcode.com/problems/permutation-in-string/\n* https://leetcode.com/problems/find-all-anagrams-in-a-string/\n* https://leetcode.com/problems/minimum-window-substring/\n* https://leetcode.com/problems/substring-with-concatenation-of-all-words/\n\n## Pattern: Two Pointers\n\n* https://leetcode.com/problems/two-sum/\n* https://leetcode.com/problems/remove-duplicates-from-sorted-array/\n* https://leetcode.com/problems/squares-of-a-sorted-array/\n* https://leetcode.com/problems/3sum/\n* https://leetcode.com/problems/3sum-closest/\n* https://leetcode.com/problems/3sum-smaller/\n* https://leetcode.com/problems/subarray-product-less-than-k/\n* https://leetcode.com/problems/sort-colors/\n* https://leetcode.com/problems/4sum/\n* https://leetcode.com/problems/backspace-string-compare/\n* https://leetcode.com/problems/shortest-unsorted-continuous-subarray/\n\n## Pattern: Fast \u0026 Slow pointers\n* https://leetcode.com/problems/linked-list-cycle/\n* https://leetcode.com/problems/linked-list-cycle-ii/\n* https://leetcode.com/problems/happy-number/\n* https://leetcode.com/problems/middle-of-the-linked-list/\n* https://leetcode.com/problems/palindrome-linked-list/\n* https://leetcode.com/problems/reorder-list/\n* https://leetcode.com/problems/circular-array-loop/\n\n## Pattern: Merge Intervals\n* https://leetcode.com/problems/merge-intervals/\n* https://leetcode.com/problems/insert-interval/\n* https://leetcode.com/problems/interval-list-intersections/\n* https://leetcode.com/problems/meeting-rooms-ii/\n* Could not find equivalent. Given a list of intervals with values, find the peak sum (i.e. if intervals are overlapping, sum their values)\n* https://leetcode.com/problems/employee-free-time/\n\n## Pattern: Cyclic Sort\n\n* 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\n* https://leetcode.com/problems/missing-number/\n* https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/\n* https://leetcode.com/problems/find-all-duplicates-in-an-array/\n* combine https://leetcode.com/problems/find-the-duplicate-number/ and https://leetcode.com/problems/missing-number/\n* https://leetcode.com/problems/first-missing-positive/\n* https://leetcode.com/problems/kth-missing-positive-number/\n\n## Pattern: In-place Reversal of a LinkedList\n* https://leetcode.com/problems/reverse-linked-list/\n* https://leetcode.com/problems/reverse-linked-list-ii/\n* https://leetcode.com/problems/reverse-nodes-in-k-group/\n* Next question is the same, but alternate each subgroup\n* https://leetcode.com/problems/rotate-list/\n\n## Pattern: Tree Breadth First Search\n* https://leetcode.com/problems/binary-tree-level-order-traversal/\n* https://leetcode.com/problems/binary-tree-level-order-traversal-ii/\n* https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/\n* https://leetcode.com/problems/minimum-depth-of-binary-tree/\n* https://leetcode.com/problems/inorder-successor-in-bst/  # Close, not exact\n* https://leetcode.com/problems/populating-next-right-pointers-in-each-node/  # Close, grokk assumes non-perfect tree\n* Next question is the same, but connect end nodes to the next level instead of null\n* https://leetcode.com/problems/binary-tree-right-side-view/\n\n## Pattern: Tree Depth First Search\n* https://leetcode.com/problems/path-sum/\n* https://leetcode.com/problems/path-sum-ii/\n* https://leetcode.com/problems/sum-root-to-leaf-numbers/\n* https://leetcode.com/problems/check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree/description/\n* https://leetcode.com/problems/path-sum-iii/\n* https://leetcode.com/problems/diameter-of-binary-tree/\n* https://leetcode.com/problems/binary-tree-maximum-path-sum/\n\n## Pattern: Two Heaps\n* https://leetcode.com/problems/find-median-from-data-stream/\n* https://leetcode.com/problems/sliding-window-median/\n* https://leetcode.com/problems/ipo/\n* https://leetcode.com/problems/find-right-interval/\n\n## Pattern: Subsets\n* https://leetcode.com/problems/subsets/\n* https://leetcode.com/problems/subsets-ii/\n* https://leetcode.com/problems/permutations/\n* https://leetcode.com/problems/letter-case-permutation/\n* https://leetcode.com/problems/generate-parentheses/\n* https://leetcode.com/problems/generalized-abbreviation/\n* https://leetcode.com/problems/different-ways-to-add-parentheses/\n* https://leetcode.com/problems/unique-binary-search-trees-ii/\n* https://leetcode.com/problems/unique-binary-search-trees/\n\n## Pattern: Modified Binary Search\n* 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\n* Did not find. Problem is find index of smallest element greater or equal to input value\n* https://leetcode.com/problems/find-smallest-letter-greater-than-target/\n* https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/\n* https://leetcode.com/problems/search-in-a-sorted-array-of-unknown-size/\n* https://leetcode.com/problems/find-k-closest-elements/ (with K == 1)\n* https://leetcode.com/problems/peak-index-in-a-mountain-array/\n* https://leetcode.com/problems/find-in-mountain-array/\n* https://leetcode.com/problems/search-in-rotated-sorted-array/\n* Similar to previous, but find the number of rotations of the array.\n\n## Pattern: Bitwise XOR\n* https://leetcode.com/problems/single-number/\n* https://leetcode.com/problems/single-number-iii/\n* https://leetcode.com/problems/complement-of-base-10-integer/\n* https://leetcode.com/problems/flipping-an-image/\n\n## Pattern: Top 'K' elements\n* Same as second question, but the first Grokking question wants the top K instead of the bottom K\n* https://leetcode.com/problems/kth-largest-element-in-an-array\n* https://leetcode.com/problems/k-closest-points-to-origin/\n* https://leetcode.com/problems/minimum-cost-to-connect-sticks/\n* https://leetcode.com/problems/top-k-frequent-elements/\n* https://leetcode.com/problems/sort-characters-by-frequency/\n* https://leetcode.com/problems/kth-largest-element-in-a-stream/\n* https://leetcode.com/problems/find-k-closest-elements/\n* 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\n* https://www.geeksforgeeks.org/sum-elements-k1th-k2th-smallest-elements/ no leetcode equivalent found\n* https://leetcode.com/problems/reorganize-string/\n* https://leetcode.com/problems/rearrange-string-k-distance-apart/\n* https://leetcode.com/problems/task-scheduler/\n* https://leetcode.com/problems/maximum-frequency-stack/\n\n## Pattern: K-way merge\n* https://leetcode.com/problems/merge-k-sorted-lists/\n* Same as previous, but return the Kth smallest number\n* https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/\n* https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists/\n* https://leetcode.com/problems/find-k-pairs-with-smallest-sums/ small difference, grokking has different sort order and wants the largest\n\n## Pattern: 0/1 Knapsack\n* https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/RM1BDv71V60\n* https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/3jEPRo5PDvx or https://leetcode.com/problems/partition-equal-subset-sum/\n* https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews/3j64vRY6JnR\n* https://leetcode.com/problems/last-stone-weight-ii/ similar concept, but problem description is more abstract.\n* https://leetcode.com/problems/combination-sum-ii/ similar, but return the number of combinations instead of the combinations\n* https://leetcode.com/problems/target-sum/\n* BONUS : Not in grokking, but I still found this very useful https://leetcode.com/problems/ones-and-zeroes/\n\n## Pattern: Topological Sort\n* First problem is identical to the following three\n* https://leetcode.com/problems/course-schedule/\n* https://leetcode.com/problems/course-schedule-ii/ \n* Same as above, but return all instead of any\n* https://leetcode.com/problems/alien-dictionary/\n* https://leetcode.com/problems/sequence-reconstruction/description/\n* https://leetcode.com/problems/minimum-height-trees/\n\n## Misc\n* https://leetcode.com/problems/kth-largest-element-in-an-array/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidf1000%2Fgrokking-leetcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidf1000%2Fgrokking-leetcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidf1000%2Fgrokking-leetcode/lists"}