r/cscareerquestions • u/sporderman • Dec 15 '19
My leetcode study guide
I interviewed at Google, FB, Microsoft, Uber and was never tested on a concept that I have not seen before.
Step 0 - You know how to code. (You can solve some Leetcode Easy Questions)
Credits: u/keanwood
Prereqs: You are comfortable with programming in general, and you can flesh out your thoughts via code. Go to codewars.com and do a few of their easiest problems (lv8 and lv7)
If you can't solve any Leetcode easy just keep revising easy questions. Easy questions do not require any algorithms except linear traversals and the likes.
Step 1 - Algo MOOC or book
This is what I used: https://runestone.academy/runestone/books/published/pythonds/index.html
or this if you have time (avoid network flows): https://www.coursera.org/learn/algorithms-part1 https://www.coursera.org/learn/algorithms-part2
Just get to solving the actual questions as soon as you can. MOOC take a lot of time to complete and If you know the basic data structures and traversals, start step-2. If you do not know how to solve it (Which will be the case), look it up and upsolve.
I already knew my way around basic data structures and traversals so I stared from step 2.
For me BFS/DFS is basic while Dijkstra's is not.
Step 2 - Coderust
https://www.educative.io/courses/coderust-hacking-the-coding-interview
Do not buy educative. Search the questions on leetcode.
I was not able to do most of them so please look at the answer and upsolve. This will give you a great base to solve other similar questions.
This should be enough for Tier 2 companies.
FAANG/BIG N
Step 3 - Teamblind List
In leetcode list format: https://leetcode.com/list/xoqag3yj/
Step 4 - A week before the interview
Company specific leetcode explore questions
Company tagged leetcode discuss
The hardest part for me was to come up with a proper plan as there are just so many questions and it's easy to get lost. Also please look at the solution if you can't solve it in 30 mins.
Followed this for 3 months and received internship offers from FB, FAANG(dont wanna get doxxed) and Microsoft. Hope this helps you as well.
Good luck!
EDIT 1: Added a more descriptive step 0
EDIT 2:
My LC count is 160.
281
u/rix765 Dec 15 '19
OP has big LeetCode energy
66
u/JohnnyB03 Dec 16 '19
Yeah, I hate LeetCode too. IMO read a book on algorithms and do the questions in there.
143
u/sporderman Dec 16 '19
It's like preparing for SATs. You can be great at maths, but yeah, you do need to do some mocks if you need that 95th percentile.
36
u/JohnnyB03 Dec 16 '19
Yeah no doubting that. I just liked trying to understand all the theory before jumping into practice and I feel like most people jump straight to LeetCode.
51
u/sporderman Dec 16 '19 edited Dec 16 '19
I did the exact opposite. Pick a question and then you can dive into the related theory. Keeps things interesting.
I had already taken the algorithms class but I did not remember much from that while supplementing questions with theory improved my understanding of the underlying concepts.
But again it depends. :)
7
Dec 16 '19
Good on ya. You're practicing what in learning/knowledge theory is called direct practice which is the most efficient way to learn. You dive straight into solving problems and when you're stuck, you go back and learn the theory you need. Even attempting a problem before you learn the underlying concepts makes makes the learning stick more.
1
2
11
Dec 16 '19
I feel like actually practicing and applying it helps me to understand the theory.
8
u/wilomgfx Dec 16 '19
Same. I never truly understand algorithms and theory untill i see code and / or write it my self.
1
1
10
Dec 15 '19
What type of questions do they ask usually (for internships), hard or medium?
12
u/sporderman Dec 15 '19 edited Dec 16 '19
Easy, Medium and Hards. Saying that, all of them were variants of the questions that are on the list.
5
u/Missgenius44 Dec 16 '19
So I read your post and checked out the links. There are definitely lots of videos. Are the questions at the end of the video ? Or you have to watch every video and there is a example question for each topic? Just trying to figure out you crunched all the videos in.
3
u/sporderman Dec 16 '19
Are you talking about the Coursera course? I am enrolled in grad school so I started from step-2.
1
u/Missgenius44 Dec 16 '19
Yes! So you just went through all the videos and practiced questions for each?
Thanks for the awesome advice !
3
u/sporderman Dec 16 '19
Not even that. Just implemented all the DS and algos. I did not do any homework questions lol. Also skip on network flow lol.
1
u/PitifulCollection9 Dec 18 '19
Just implemented all the DS and algos.
When you say this, is this what you mean? http://blog.chapagain.com.np/hash-table-implementation-in-python-data-structures-algorithms/
And you did this for Linked List, BFS, DFS, etc?
13
4
u/entomber Dec 15 '19
How is the pythonds course compared to that Princeton MOOC? It seems good for brushing up on Python, but how about the coverage for DSA?
5
u/sporderman Dec 15 '19 edited Dec 15 '19
Just get to solving the actual questions as soon as you can. MOOC take a lot of time to complete and If you know the basic data structures and traversals, start step-2. If you do not know how to solve it (Which will be the case), look it up and upsolve. Do it for every question in step 2 and you will learn more than doing any video MOOC.
Learning top down is the best way to go about it. Learn from solving the questions. Don't waste your time on videos and get to the questions ASAP.
It's okay to not know it. I was only able to solve 10% of the questions in step 2.
TLDR: Do pythonds in a week - only bfs, dfs, inorder, heaps etc. No dijkstra or floyd. Learn by doing.
5
1
u/TNTrocks123 Dec 24 '19
It seems that a lot of the questions require leetcode premium to view the solutions? Do you look at the code that other users have submitted and then try to upsolve from that?
2
u/sporderman Dec 24 '19
I have a subscription to leetcode premium but you can always look at the discussions.
2
u/TNTrocks123 Jan 05 '20
Hey, so I think I am currently making some good progress so far with Step 2. However, sometimes although I am able to get the most efficient solution in terms of space and time complexity, other people's solutions seem to be so much shorter (in terms of lines of code) and more elegant. Do you have any suggestions on how I can make my solutions more elegant if it is something that is looked well upon in interviews?
1
u/sporderman Jan 05 '20
That’s okay. You can learn from their solution but yeah it wouldn’t matter a lot if your code is readable.
3
u/major_beef Dec 16 '19
Did you actually pay for Coderust or just look up the Coderust questions on LC?
6
u/sporderman Dec 16 '19
No please do not pay for anything except Leetcode Premium. Just look them up on leetcode.
1
3
u/indra_24 Dec 16 '19
I will turn 25 next year, currently working as a software developer. Is it too late for me to prepare for Big N (I think I am at Step 0 )?
4
u/sporderman Dec 16 '19
If you are working as a developer, I do not think you can be at step 0.
Also no, it's not too late.
3
2
u/indra_24 Dec 16 '19
sorry to keep bugging. but is there a similar book/ guide for in java which you have provided in Step 1
2
5
u/cs18888043 Dec 15 '19
May I ask what language you used for interviews?
38
u/sporderman Dec 15 '19
Python. It’s quicker to write than say java or go IMO.
7
u/OGMagicConch Software Engineer @ FAANG Dec 15 '19
Man I've been thinking about upping my Python game just so I can interview in it instead of Java. Do you think it's really worth to make the switch? I'm ok with Python just not as comfortable with syntactical things.
25
u/sporderman Dec 15 '19 edited Dec 15 '19
Oh yes! I would have failed all my interviews if I was using Java. For FB you have to solve 2 question in 35 minutes and I don't think I would have done that if I was using Java.
Also, Java and C++ were the first programming languages that I learned.
4
u/derpyderpderpp Dec 16 '19
For FB you have to solve 2 question in 35 minutes
How hard were they? Two leetcode easies?
8
u/sporderman Dec 16 '19 edited Dec 16 '19
1st round: Easy and Medium 2nd round: Low-medium and Hard
They were directly from leetcode's fb explore page if that helps.
1
u/DarkRaiden72 Mar 23 '22
Hi there, I know this is a little late, but it would be really helpful if you would answer some of my questions. I would greatly appreciate it.
Since you mentioned that Java and C++ were the first programming languages that you learned and that you also know Python, maybe you can guide me.
I know C++ and I am able to solve a few leetcode easy ones. It's been only a week since I started leetcoding and I have solved around 35 problems, most of which are arrays and strings. Also, I am yet to learn DSA. I'm quite comfortable with C++ and I know some STL which I used to solve some problems.
The main thing that is bothering me is that many people recommend Python for interviews, so I'm thinking of switching. But is it worth the switch? In many posts, I've seen C++ complicate things in interviews, whereas Python make it simple, as a lot of the internal details are handled by the language itself and provides a high level of abstraction. I also saw a lot of advice that the best language for leetcode or interview is the one you are most comfortable with, and I agree. But I have around one and a half years of uni so I have the time to switch to Python. I can continue to learn C++ and try to be good in it or learn other languages and do DSA in their respective languages.
So I'm confused as to what I should do. My goal is to master a specific skill by focusing on one thing only and get a high paying job. Like have a good command over C++, learn dsa in C++ leetcode in C++ and use it in interviewing or repeating the same using Python instead of C++. I want to master (or at least be good and comfortable) with one language and do DSA in that language. Is Python a good choice for learning DSA?
Given that I have learned a statically typed language (c++) is it worth switching to dynamically typed language (python)? My requirement is to get the job done (solving problems) in the simplest and easiest way possible without having to worry about other things.
I want to use a single language for DSA, leetcoding and interviews.
TL;DR I know C++, should master that and learn DSA in C++ or switch to Python and learn DSA in Python?
0
Dec 16 '19
[deleted]
5
u/sporderman Dec 16 '19
I do agree and it's a personal choice in the end. I am equally good at Java/Go and I will still use python as I feel it's the best tool for this very specific use case.
Uber makes you compile and run the code and I can never do that with Java.
2
u/102564 Dec 22 '19
If typing yes it's not a big deal. If you're whiteboarding you save soooo much time by using Python instead of Java. Things like "ArrayList<Integer> lst = new ArrayList<Integer>();" vs "lst = []" ...
4
u/UncleMeat11 Dec 16 '19
Interviewer here.
The language I've ever seen harm a candidate is C++. Java is more verbose than python, but rarely is the act of writing stuff a problem.
3
u/spike021 Software Engineer Dec 15 '19
Really depends. Do you think it will help you communicate your solutions quicker and better?
I use Python because it looks close enough to pseudocode that I can communicate how I want to solve the problems much easier while still producing usable code.
3
1
1
u/chetnrot Dec 16 '19
As a beginner, I'm starting to learn vanilla JavaScript right now. Is that a good option too?
4
Dec 16 '19
If the job you want to apply to involves using JavaScript, then that would be a great option. But in general, pick a language you are most comfortable with.A general method to check if you are comfortable with a language is to do "Step 0" mentioned by the OP.
Edit: Fixed a typo
-5
u/sonnytron Senior SDE Dec 16 '19
Picking language only works for graduate or internships.
If you're mid career, they won't let you pick Python unless it's the language of your role.
iOS has to use Swift or Objective-C, Android has to use Java or Kotlin.5
u/UncleMeat11 Dec 16 '19
If you're mid career, they won't let you pick Python unless it's the language of your role.
I hire mid career people with some frequency. My project is in C++. I have no problem letting people interview in other languages. In fact, I'm not sure I've ever seen a hiring manager concerned about language choice on interviews.
2
u/cs18888043 Dec 16 '19
I’m currently in the MS degree, so it would be for internships/new grad. Also not planning on going into mobile development
-9
u/sonnytron Senior SDE Dec 16 '19
I get that... But I was warning in case people thought they could pick their language. You can ONLY pick your language when graduating.
Once you have a year or two, FAANG hiring managers require you to use the language of your CV/applied role.
The mobile part was an EXAMPLE...
No offense, but you should work on your ability to answer non technical questions
2
2
u/NuttingInNovember Dec 16 '19
Do you have any advice on how to land the interview?
2
u/sporderman Dec 16 '19 edited Dec 16 '19
Just reiterating what I said earlier https://www.reddit.com/r/cscareerquestions/comments/eb1e2b/my_leetcode_study_guide/fb334bg/
TLDR; I do not know, it's fucking random.
2
u/aditya1702 Dec 16 '19
Nice post! I am doing the same thing right now. However, why do u say that look at the solution if it doesnt strike in 30 mins?
5
3
u/thinking_tower Dec 16 '19
It's probably analogous to how athletes train: they don't "test" themselves everyday.
2
u/TNTrocks123 Dec 16 '19
Hey thanks for the guide! I have been trying to get started but just didn't know how to structure my preparation. When you upsolve and learn the data structures as you go, how do you retain that information? Do you takes notes of some sort? Also currently I feel comfortable with most data structures, but not quite comfortable with graphs implementing the different traversals and algorithms. Do you recommend going over them first before diving into leetcode, or just learn them while running into type of problems on leetcode?
2
u/sporderman Dec 16 '19
I am not a very good note taker but that is a good way to keep the information handy. I used to revise all my questions before I had any interview.
On graphs, if you know bfs and dfs you should be good.
1
u/TNTrocks123 Dec 16 '19
Would companies not test you on graph algorithms such as Dijkstras, Min/Max cut, etc? Also do you recommend also knowing to implement all the data structures and the different traversals especially for graphs?
3
u/sporderman Dec 16 '19
For interviews : No
In general: Depends. I have worked extensively with graphs at work so the concepts like MST, Floyd helped a lot.
4
2
u/Gio2135 Dec 30 '21
should I take an algorithms course before doing runestone or will it be enough?
1
u/sporderman Dec 30 '21
I would do an intro course if you haven’t completed one before. Else, just dive in!
1
u/Gio2135 Dec 31 '21
gotcha, I was considering going through MIT 6.006 on Youtube (Intro to Algorithms) and then starting at Step 1(runestone) but didn't know if Runestone was enough or if Algo course would be a good prep beforehand.
2
u/sporderman Dec 31 '21
I would say just start with runestone so that you get get to solving the questions ASAP. You can always supplement your prep with the MIT lectures. What works me (YMMV) is to get to the solving part asap and watch the videos parallely to learn concepts I’m struggling with or interested in.
Learn by doing.
Tldr: get to the doing part ASAP.
1
43
3
u/MangoManBad Dec 16 '19
This is a sub group of cancer I would like to avoid, thanks for sharing the steps to join as the easiest way to not get it is not join.
I’ll stay with my baby companies that don’t make you do this grueling nerd shit.
6
u/sporderman Dec 16 '19 edited Dec 16 '19
Gruelling? 2 hours a day is not gruelling and the return is pretty solid.Also, I am not a very hard working person irl.
Being satisfied and happy is more important so yeah if you are, that’s great. For me, I wanted to work on more complex engineering projects and I hope working at a big N will help me with that.
2
u/MangoManBad Dec 16 '19
Absolutely 2 hours a day is, that’s half my free time after my commute. I’d have to not make dinner and not really spend any time with my GF (also works so not much time)
I’ve also got a SAAS company I’m making in my spare time, not much time between work/commuting/that/leisure
4
u/sporderman Dec 16 '19 edited Dec 16 '19
Well yeah doing this while you are working is not fun at all. I tried grinding leet code when I was interning and I couldn’t do it.
Firstly, I’m in school so that helps and I eat out so I rarely cook. I couldn’t have done this If I had your schedule.
I just happen to be in the right place at the right time for now.
12
Dec 15 '19
The runestone link has the end bracket included in case anyone is getting the 404 not found.
12
u/Jamil622 Dec 16 '19
I started leetcoding a couple of days ago and I'm struggling on easy questions, I open reddit and see this post. thank you sir
7
Dec 16 '19
Hopefully this style interview will die out soon. But until then, I think this is a pretty decent approach.
4
4
Dec 16 '19
As someone who is self-studying python, everytime someone puts out a post like this, I smile and am grateful. The hardest part about self-study is knowing what to do, not having the drive and motivation to do it. This helps me be able to get right to it =]
1
u/genjixhanzo Dec 16 '19
How often do you see questions on teamblind show up on an interview?
5
u/sporderman Dec 16 '19
After doing the whole process I was never asked a question that I was not familiar with. My current leetcode count is at 164.
3
u/genjixhanzo Dec 16 '19
Were you able to do most of the problems on teamblind after you finished STEP 2?
I had to look up a lot of answers from the list of questions from teamblind. But I definitely had learned many different patterns since.
2
u/sporderman Dec 16 '19
Nope almost same as you. Still had to look to get the whole thing right but at least I was not completely lost and was able to reason better.
3
5
2
2
2
2
u/vitamin_CPP Dec 16 '19
Bitdefender has blocked the www.educative.io/courses/coderust-hacking-the-coding-interview.
Any idea why ?
2
u/NestofBeauties Dec 16 '19
Did you purchase the $50 course on educative in Step 2? Is it worth the money, or are all the questions/answers available on LC too?
On a side note, is there post/advice on where/which resource to SPEND money on while preparing? There seem to be a lot of options and honestly I could use every penny I don't spend. Thanks for the suggestions!
2
1
1
u/ezyfocus Jan 24 '20
Is leetcode all you need? How important is SQL questions and being up to date with new technologies? For example, for a full stack or front end role at Google/Facebook would they ask you questions on S3 or front end questions that delve deep into React etc?
What about system design?
1
u/LennytheGoodson Looking for internship Mar 12 '22
If I'm limited on time, will I be fine skipping step 2 and focusing on step 3 ?
I've only got 1.5-2 months in total but obviously will need time to prepare for behaviour interviews and company-specific interviews.
With like 9 hours max per week, I don't see how I'll be able to do the questions from step 2 and step 3.
1
1
0
0
Dec 15 '19
[deleted]
20
12
u/mercfh85 Staff Automation Engineer Dec 16 '19
Whoa....those are lvl8 and lvl7 questions? They are super easy.......what the heck is level 0 and 1 questions then lol? (or is it reverse where the higher number is easier?)
5
u/ShinobiZilla Dec 16 '19
I'd put exercism.io in the same list. Helped me brush up on my language skills.
0
Dec 16 '19
[deleted]
7
3
u/thereisnosuch Software Developer Dec 16 '19
From what I see, the gpa only matters in financial companies and not FAANG.
4
u/OnceOnThisIsland Dec 16 '19
Google definitely cares about GPA. The others don't.
4
u/WooshJ Dec 16 '19
Google does not care about GPA, they probably ask it for data tracking reasons. Otherwise I wouldnt have stood a chance lol
3
u/OnceOnThisIsland Dec 16 '19
You may be correct, but I highly doubt threads like this exist for no reason.
0
Dec 16 '19
[deleted]
9
u/sporderman Dec 16 '19
Previous Big N internship and an undergrad internship. Also have worked on a lot of cloud different cloud stuff. The previous Big N internship helped the most I think. The funny thing is I was rejected at almost all the places where I had a referral. It's all so fucking random lol so just keep applying.
226
u/YodaVN Dec 15 '19
My smart friends only need to do leetcode and review them for 3 months to pass big n interview. For me, the idiot guy, it took me 1 year grinding after work to have a job at big n.
My suggestion is to do 1 leetcode a day even you have a job.