All Projects → sarthfrey → Leetcode Course

sarthfrey / Leetcode Course

A guide to crushing tech interviews.

Projects that are alternatives of or similar to Leetcode Course

Imagenetv2
A new test set for ImageNet
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Deeplearning.ai Convolutional Neural Networks
Completed assignment jupyter notebook of Foundations of Convolutional Neural Networks, deeplearning.ai coursera course
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Spark R Notebooks
R on Apache Spark (SparkR) tutorials for Big Data analysis and Machine Learning as IPython / Jupyter notebooks
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Isl Python
Solutions to labs and excercises from An Introduction to Statistical Learning, as Jupyter Notebooks.
Stars: ✭ 108 (-1.82%)
Mutual labels:  jupyter-notebook
Hass Data Detective
Explore and analyse your Home Assistant data
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Ml Da Coursera Yandex Mipt
Machine Learning and Data Analysis Coursera Specialization from Yandex and MIPT
Stars: ✭ 108 (-1.82%)
Mutual labels:  jupyter-notebook
Shot Type Classifier
Detecting cinema shot types using a ResNet-50
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Kubeflowdojo
Repository to hold code, instructions, demos and pointers to presentation assets for Kubeflow Dojo
Stars: ✭ 110 (+0%)
Mutual labels:  jupyter-notebook
Street to shop experiments
Stars: ✭ 108 (-1.82%)
Mutual labels:  jupyter-notebook
Credit score
data from the kaggle 'give me some credit" competition
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Simple mf
Simple but Flexible Recommendation Engine in PyTorch
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Histbook
Versatile, high-performance histogram toolkit for Numpy.
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Alexnet Experiments Keras
Code examples for training AlexNet using Keras and Theano
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Solvingalmostanythingwithbert
BioBert Pytorch
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Densecap
Dense image captioning in Torch
Stars: ✭ 1,469 (+1235.45%)
Mutual labels:  jupyter-notebook
Clx
A collection of RAPIDS examples for security analysts, data scientists, and engineers to quickly get started applying RAPIDS and GPU acceleration to real-world cybersecurity use cases.
Stars: ✭ 108 (-1.82%)
Mutual labels:  jupyter-notebook
Nb pdf template
A more accurate representation of jupyter notebooks when converting to pdfs.
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook
Nvidia Gpu Tensor Core Accelerator Pytorch Opencv
A complete machine vision container that includes Jupyter notebooks with built-in code hinting, Anaconda, CUDA-X, TensorRT inference accelerator for Tensor cores, CuPy (GPU drop in replacement for Numpy), PyTorch, TF2, Tensorboard, and OpenCV for accelerated workloads on NVIDIA Tensor cores and GPUs.
Stars: ✭ 110 (+0%)
Mutual labels:  jupyter-notebook
Mtcnn
MTCNN face detection implementation for TensorFlow, as a PIP package.
Stars: ✭ 1,689 (+1435.45%)
Mutual labels:  jupyter-notebook
Prisma abu
用机器学习做个艺术画家-Prisma
Stars: ✭ 109 (-0.91%)
Mutual labels:  jupyter-notebook

LeetCode Course

This is a course designed to ramp up an individual ASAP to crush tech interviews.

At some point I will be expanding upon concepts in this general guide, but I'm quickly typing this up now to help some friends (shoutout to hansson and revanth).

How to use this Doc

At any step, feel free to continue to any later step. That said, this stuff is inherently a graph of knowledge and so it's not well suited to linear presentation. However, at the very least, you can trust that following this guide in a linear fashion will be a valid progression strategy.

Step 0: Requirements

You will need:

  1. A LeetCode account, ideally with premium (you can share with friends and use the "session" feature to differentiate yourselves)
  2. The latest version of Python, downloadable here
  3. This doc + internet connection

Step 1: Optionally Learn Python

Python is the best language for interviews because it's quick to write, it's readable, and it's heavily used in industry.

What to learn:

  • Basic syntax
    • Variables
    • Math
    • Strings
    • Lists, sets, dicts
    • Printing
    • Functions
    • Classes
    • Loops and control flow
    • Recursion
  • Runtime + Space complexity concepts, here or here or here, make sure you know the runtime for all the Python data structures you use
  • I also recommend you learn generators, coroutines, list comprehension, useful builtins (sorted, breakpoint, zip, enumerate, etc) as knowing this can impress interviewers but more importantly, make you more effective at coding
  • It will take many years to have intuition for what's pythonic vs not, but at the very least learn what I've mentioned here

How to learn:

  • If you have very limited programming experience start here, otherwise continue
    • I learned Python here when I was 12 and to this day it's the simplest intro I've seen
  • I start learning any language by browsing its Learn X in Y
    • Check out the one for Python here
  • https://stackoverflow.com/
  • https://www.google.com/
  • A realistic guide to AsyncIO in Python3.7+, don't look at this unless you plan on truly knowing Python

Step 2: Jump into Leetcode

At this point, many people would encourage you to start reading up about algorithms and data structures. If you want to do that then skip to the next step, but otherwise I recommend jumping into LeetCode and doing a few "Easy" difficulty level problems in order to give you a feel for it. Whatever your approach is to picking problems to try, I highly recommend avoiding ones that have a high proportion of thumbs-down's to thumbs-up's. If you have a subscription, don't look at the solution until after you've tried it, and if you needed to look at the solution then favourite the problem and do it again a week later.

Here is a list of simple problems. You will notice that the problems cover simple data structures like lists and dictionaries, which is why they aren't covered in the next step. Make sure you at least know those two before diving in!

  • Two Sum will teach you about how using data structures can often improve runtime
  • Merge Sorted Array shows you that having things already sorted can be useful
  • Rotate Array is a great example of how you can take an easy question and make it harder by posing follow up questions (very common in interviews!)
  • Best Time to Buy a Stock lays the groundwork for something magical, dynamic programming
  • Fizz Buzz, while meme'ed, can teach some unlucky folks (including me 7 years ago) that control flow requires some thought

I will add more to this list, but for now I think those 5 are good enough to test some basic Python skills.

Step 3: Learn Concepts

Often times in programming, we work with data structures which are simply objects that have rules for how data is accessed and added. Typically data structures will have an insertion time, deletion time, and a lookup time. For more on data structure basics, go here. Now we can dive into commonly seen basic data structures and good LeetCode questions to make use of them. We often see specific algorithms tied to these structures.

Important Note: For each of the data structures, you should implement them locally with classes and everything. To learn more about each of these just use Google. Do this before trying the LeetCode questions, it's a useful exercise and sometimes the interviewer will be impressed with your ability to write __repr__ dunders.

Binary Search

Sorting

To be honest, sorting questions are pretty rare. I still can't for the life of me remember the quick sort algorithm. It's definitely useful to know, but you can usually get away with just knowing merge sort, which IMO is much easier to remember and has the same average runtime. For sorting runtimes, look here. That said some other algorithms like radix sort can come in handy, but if you're time strapped I would just learn merge sort and move on.

Linked List

Stacks and Queues

  • For learning
    • Learn about the stack and queue
    • Check out Stacks and Queues.ipynb in this repo for an example Python implementation, note that a node implementation is also valid, and ideally you also have accessors
    • Valid Parentheses is a classic stack question and often times gets extended to make hard questions
    • Implement Stack using Queues is another prototypical question
    • Design Circular Queue is a fantastic data structure question which combines many concepts together, also circular buffers are widely used everywhere, the most popular big data processing frameworks use them as an example, refer to this
    • Flatten Nested List Iterator demonstrates the common "flattened list" type problem, but I highly recommend also solving this one with a generator, it's a lot of fun and is also ideal, yield from in Python is awesome :)
    • Trapping Rain Water is fun because there are so many ways of doing it, note that O(n) time with O(1) space is possible!
  • For a challenge

Trees

Heaps

  • For learning
    • Read up on them here and implement locally
    • Kth Largest Element in an Array is my favourite heap question for learning because there are many ways to solve it, try doing it with a max heap and also doing it with a min heap - note that they have different runtime complexities!
    • Find Median from Data Stream is easy for a hard, so it's a nice ego boost :)
  • For a challenge
    • Usually the hardest problems that use heaps require other knowledge and become a part of the solution for some other topic

Tries

  • For learning
    • Learn about em here
    • I will note that trie questions become 1000x easier if you remember that tries are a thing
    • Implement Trie is a good starter
    • Map Sum Pairs shows why tries are useful
  • For a challenge
    • Palindrome Pairs is a good display for how multivariate runtime problems have vague optimality

Dynamic Programming

This took me a long time to learn properly, and I don't think I really truly understood it until I took an algorithms course at school. Approximately 50% of my LeetCode time is dedicated to DP, and now I feel more comfortable with it than other concepts. Note that a lot of tech companies ask this stuff.

  • For learning
    • I haven't found many great resources for DP but I'll defer to the "Basic Concepts" section of the DP guide at Geeks for Geeks
    • For solving these, I recommend having a piece of paper on hand
    • You should try to explicitly state the recurrence
    • If you can't come up with the recurrence then make an intuitive guess as what subproblems you need, and then mock up a memoization table for a simple example input to the problem, and try to infer the recurrence from the pattern in the table
    • Triangle is one of the simplest DP problems I've seen that I would actually classify as a DP problem
    • Minimum Path Sum is another easy one and the board path pattern comes up often
    • Longest Palandromic Substring is the perfect DP question, I recommend writing up the memo table for this one to get comfortable with that concept
    • Decode Ways is another good one that I've been asked many times, a cool follow up question is how would you implement this with distributed machines that each can only fit part of the input into memory?
    • Coin Change, getting a bit harder
    • Unique Binary Search Trees, I have banged my head on this problem many times over the years because it requires looking at it in a certain way
    • Edit Distance this is one of my favorite questions on LeetCode, because I come from an NLP background and this algorithm is super super important. I've used it at work countless times and in a project here
  • For a challenge

Graphs

If you're strapped for time then don't spend much time on this, just learn traversals.

Step 4: Consolidate Knowledge

This is the part where you make sure you know your stuff. Previously, you knew what data structure you needed before trying the question. Now you should pick 5-10 random mediums and do them. If you are struggling, then either go back to step 3 or take a breather, read through the solutions, and go back later. Here are some tips for general LeetCode use.

  • If you find you are struggling on a certain kind of problem use the "tags" feature in LeetCode to look for specific problem types
  • If you have an interview with a specific company coming up, LeetCode compiles a list of questions that specific companies have asked. I would not count on memorizing solutions to those problems - it's unlikely to help, and even if you get lucky then it's not sustainable for the future - so put in the work
  • That said, I do recommend looking at those lists to get an idea of what kinds of questions your interviewer might favour, and if you see some good problems on the list for a company you have an interview with then definitely prefer doing those problems over others

Step 5: Next Steps

Do the following.

  • Read more on divide and conquer approach, but tbh if you know merge sort this is easy (often involves assuming parts of the inputs are solved and then merging them, recursively solving each part)
  • Read more on greedy algorithm approach (often involves sorting first, and maximizing/minimizing some heuristic)
  • Practice more DP/Graphs
  • Do heavily liked LeetCode mediums/hards
  • LeetCode has great SQL and concurrency questions too, highly recommend trying some
  • Do mock interviews with friends! Communication is an underrated skill, and extra points for practicing on a whiteboard
  • Once you learn all this, in the future you need only refresh your knowledge, my friends and I do around 15-20 problems at the beginning of each job search, usually starting ~1 month before we expect any interviews
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].