Instantly share code, notes, and snippets.

# tykurtz/grokking_to_leetcode.md

Last active June 7, 2023 02:59
Grokking the coding interview equivalent leetcode problems

# 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.

## Misc

### dyu222 commented Jul 30, 2022

^^ here is the first problem is islands https://leetcode.com/problems/number-of-islands/

### shan4993 commented Aug 1, 2022

Merge Intervals is missing a problem: Conflicting Appointments (medium) -> https://leetcode.com/problems/meeting-rooms/

### shan4993 commented Aug 3, 2022

Not an exact match but close enough.

Ceiling of a Number (medium) -> https://leetcode.com/problems/search-insert-position/

### khatiba commented Aug 3, 2022

@i-zanis topological orderings are not unique right?

### swarnabhK commented Aug 4, 2022

Thanks for the list! Can anyone point me out to some resources where I can learn these patterns?

### unrelentingfox commented Aug 4, 2022 • edited

The topological sort 1st and 3rd question is exactly the same as a solution in Grokking. I converted the List to return int[] instead however when I test it on leetcode, the output is not in the same order. Does anyone know something?

The direction of the dependency graph in the leetcode problem is in reverse. For each edge, the first value is a course, the second value is it's pre-requisite. To determine the order in which to take all of the courses, you traverse from pre-requisite -> course.

So from your code change this:
`int parent = edges[i][0], child = edges[i][1]`
to this:
`int parent = edges[i][1], child = edges[i][0]`

Not all heroes..

### shan4993 commented Aug 6, 2022

For Tree BST (right after zig zag) should be https://leetcode.com/problems/average-of-levels-in-binary-tree/

### i-zanis commented Aug 14, 2022

Anyone found any other problems in the Islands?

### vinit2997 commented Aug 19, 2022

Is there a Leetcode list of all these questions?

### AnasjSaad commented Aug 21, 2022

Great List, thank you!

### himnish0 commented Oct 11, 2022

https://libgen.is/search.php?req=grokking+the+coding+interview&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def

If link isn't working , then go to libgen (generally libgen.is) and search for the course there....the extracting method remains the same.

### shazib-summar commented Oct 11, 2022

https://libgen.is/search.php?req=grokking+the+coding+interview&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def

If link isn't working , then go to libgen (generally libgen.is) and search for the course there....the extracting method remains the same.

kinda feel bad for the authors, but thanks

### thrownullpointer commented Oct 12, 2022

If you feel bad for the author pay \$79 for lifetime access. There is a 20% off coupon so its \$63.20. https://designgurus.org/course/grokking-the-coding-interview

### newpain01 commented Oct 14, 2022

https://libgen.is/search.php?req=grokking+the+coding+interview&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def

If link isn't working , then go to libgen (generally libgen.is) and search for the course there....the extracting method remains the same.

This is awesome, thanks!

### himnish0 commented Oct 14, 2022

https://libgen.is/search.php?req=grokking+the+coding+interview&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def
If link isn't working , then go to libgen (generally libgen.is) and search for the course there....the extracting method remains the same.

This is awesome, thanks! Have you seen the system design interview somewhere?

No but if you do, kindly share.

### newpain01 commented Oct 14, 2022

https://libgen.is/search.php?req=grokking+the+coding+interview&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def
If link isn't working , then go to libgen (generally libgen.is) and search for the course there....the extracting method remains the same.

This is awesome, thanks! Have you seen the system design interview somewhere?

No but if you do, kindly share.

I found this: https://github.com/donnemartin/system-design-primer
Some people mentioned it's inspired by grokking, but I wouldn't know.

### efie45 commented Oct 21, 2022

Awesome list!

For Cyclic Sort, you have the last item in the list linked to https://leetcode.com/problems/kth-missing-positive-number/ which is not correct.

The leetcode question has an array of sorted, positive numbers and you are looking for the kth missing positive. This is an LC easy and you don't even need cyclic sort since the numbers are already sorted.

The grokking question is an unsorted array containing both positive and negative numbers, possibly duplicate values, and you are finding all values from 1-k. This is a LC hard (per grokking)

### navidre commented Nov 8, 2022 • edited

There is a new grokking course on Educative. I am creating a new mapping. Pull requests are appreciated. Link: https://github.com/navidre/new_grokking_to_leetcode

letss goo

### JunYuHuang commented Nov 17, 2022 • edited

If you feel bad for the author pay \$79 for lifetime access. There is a 20% off coupon so its \$63.20. https://designgurus.org/course/grokking-the-coding-interview

I bought the course a couple months ago for full price and all I can say is that I regret buying it and feel it was a waste of money. For how much it costs for what is basically a curated LeetCode problem set with solutions, a significant amount of the solutions don't offer much in depth or detailed explanation and some of the solutions fail to pass their closest LC equivalent problems. I've found better solution explanations and help from looking on the Discuss page of those LC problems and watching NeetCode's video solutions.

### lamquangtruongnguyen commented Dec 15, 2022

Thanks for sharing

Thanks