In the Name of Allah, the Most Beneficent, the Most Merciful

It is important that you do some prep work ** before** practicing on Leetcode, GeeksForGeeks, or Cracking the Coding Interview (CTCI) — especially if you graduated from college a long time ago or are self-taught.

A lot of people become discouraged because they think that they’ll be competing with young, recent grads that have all the time in the world for reviewing stuff they just learned. I find that funny because many recent grads also feel discouraged by thinking that they’ll be up against “professionals” with “real life experience” (whatever that means).

In reality, there is basically no competition. It’s not a zero-sum game. If you count the total number of software engineers in the job market (including new grads, professionals, self-taught devs, and Bootcamp grads) and compare that to the number of job openings, you’ll end up with the following figure:

Companies are desperate for SEs — if you can only prove that you’re good enough, they’ll take you. There’s almost no hiring cap for talented engineers, especially in larger tech companies. In many cases, they’ll be willing to create new roles for you if you do well in the interview. If you practice smart and solve enough problems on Leetcode/CTCI, you’ll be in good shape. Don’t worry about the competition.

This section is very important so please pay attention. Before you start Leetcoding, you need to study/brush up a list of important topics. If you don’t, you’ll end up wasting your time. Remember the two following rules:

- Don’t spend
**too much**time on the prep work. - Don’t spend
**too little**time on the prep work.

If you spend too much time studying, you’ll never get to solve Leetcode/CTCI problems. Conversely, you’ll be lost if you spend too little time on the prep work. It is important that you spend the right amount of time for the prep work to make sure that you do not waste your time.

Before you do anything, make sure to review/learn the topics below. Learning anything additional may be a total waste of your time. Some people study way more than they need to (ex fancy graph algorithms, Spanning tree, A*, etc) because they think that’ll make them better engineers. That’s a total waste of time in my opinion. Most interviewers don’t remember those topics themselves. You can learn them on your own once you land your dream job. ** Don’t waste your time**. Just focus on learning the Data Structures & Algorithms below. Nothing more, nothing less.

- Dynamic Array
- Linked List
- Stack & Queue
- Hash Tables
- Binary Search Tree
- Binary Heaps & Priority Queue
- Graphs
- Trie

- Bit Manipulation & Numbers — difference btw Unsigned vs signed numbers
- Stability in Sorting
- Mergesort
- Quicksort
- Heapsort — Sort it in-place to get O(1) space
- Binary Search
- Selections — Kth Smallest Elements (Sort, QuickSelect, Mediums of Mediums) — Implement all three ways
- Permutations
- Subsets
- BFS Graph
- DFS Graph
- Dijkstra’s Algorithm (just learn the idea — no need to implement)
- Tree Traversals — BFS, DFS (in-order, pre-order, post-order): Implement Recursive and Iterative
- External Sort — No implementation; Just know the concept.
- NP-Complete (Video) — Just know the concept
- Topological Sort
- Detect cycle in an undirected graph
- Detect a cycle in a directed graph
- Count connected components in a graph
- Find strongly connected components in a graph

Once you are comfortable with the data structures & algorithms above, do the following exercise multiple times (at least 2–3 times) until you can do them with your eyes closed.

- Implement an ArrayList from scratch
- Reverse a linked list
- Implement a Stack & a Queue using Array
- Implement a HashTable with simple Hashing functions
- Implement a Graph using Adjacency List, and then write functions for BFS & DFS.
- Write the binary search algorithm both recursively and iteratively
- Write the merge sort algorithm
- Write the quicksort algorithm
- Print binary tree using DFS (in-order, preorder and post order — all three of them) and BFS.
- Memorize time & space complexities for common algorithms. Here’s an interesting website.
- Implement a trie.
- Learn these important bit manipulation tricks.

Once you’re done with that, you may move on to the next step. Depending on how comfortable you are with Data Structures and Algorithms, it may take anywhere from **2 weeks** to **3 months** to review them. If you’re a total beginner (self-taught developer?) it may take up to **6 months**.

I applaud you for reading this entire post. You’re already ahead of the game by doing that. I want to sincerely wish you luck in this journey. These are the most difficult moments of your engineering career life. On one hand, I want you to take all of this seriously. On the other hand, I want you to realize that you’ll remember and cherish these moments. You will actually miss these precious moments of grinding and struggling to solve algorithmic challenges after you get your dream job.

It took me a very long time to get where I am today. For a long time, I thought that I was too dumb and stupid. I was comparing myself with smarter kids in college and never thought that I would be able to get lucrative offers from giant tech companies.

I know how tough it is to do all of these challenges. Everyone talks about Leetcode as if it’s a piece of cake. It’s really not. Please don’t lose motivation.

Where ever you are and whoever you are, I pray for your success ❤️.

Have fun coding 👨💻!