Roadmap for mastering Coding & Competitive Programming interview
Are you non-computer background student? I am a Electronics Engineering student and have been in software company and worked more than 16 years from junior developer to as full stack developer with angular and c# asp.net and various web development technologies. How should I plan to learn competitive programming in order to crack Big 4 (Google, Facebook, Amazon & Microsoft) companies coding-interviews?
Nowadays, even consulting companies like Infosys, TCS etc., are asking some coding problems in their interview. Therefore, if you are not preparing for FAANGM ( facebook, apple, amazon, netflix, google, microsoft) still you must learn how to code and practice coding. Solve easy problems from each Data Structure and sharpen your Logic skills.
If you are a beginner like me, never start directly solving competitive programming problems. First solve Data Structure and Algorithm problems. Read this to know what is the difference between Data Structure and Algorithm problems and Competitive Programming problems. So basically, you have start learning coding from basic.
Start solving problems in below sequence to practice:
- Solve Data Structure and Algorithm problems especially from GeekOfGeeks site.
- Solve Competitive Programming problems especially solve it from Leetcode. Here is the list of problems from Leetcode that you must try solving them.
I myself did very hard work and trying to solve problems given by Love Babbar 450 questions and from many other places.
- You can view my solutions in JavaScript in this codepen link.
- I also solved couple of problems related to basic data structure and algorithm here.
You can always fork my codepen and do the changes. I have added Jasmine Test in my code pen so that you can write function and run your specs.
Here is one example how you can solve problems all related to binary search and run specs to proove that they all work.
See the Pen Finding first or last occurrence of a number by Rupesh Tiwari (@rupeshtiwari) on CodePen.
Which Language should I use in a coding interview?
Many companies don’t prefer Python in coding interviews. Because, it has an in-built library for stack or so on. If you are doing Python then learn one more language in backup ( C#, C, C++ or Java ). Python is mostly used in Data Science and Machine Learning since these topics are very complex and you must write less code to solve these big problems. I personally use JavaScript language.
Where should I practice for Data Structure and Algorithm problems?
Use geeksforgeeks.com to practice data structure and algorithm problems.
- Solve Problems for DataStructure & Algorithms
- Read company interview experiences that will explain you how companies take interview what are their patterns.
Amazon, Meta (FaceBook), Google, Microsoft etc. they ask the questions from the Geek for Geeks sometime. So it is a good idea to solve them. Geeks For Geeks is the best site to start learning coding for any beginners.
Here is the steps to start coding practice.
- Go to https://practice.geeksforgeeks.org/
- Select Data Structure like start from Array.
- Select the difficulty level easy ( if you are beginner I would say try School and Basic level first )
- Daily do minimum 2 questions one from easy one from medium level difficulty
- For each Data Structure target yourself to solve 50 questions
- Do more than 50 questions for Array and String related problems especially
In Geek of Geeks you can filter difficulty level and you can also check which problem is asked in which company. Select Array then filter by Basic, Medium or Hard then work on them.
If you want to dedicate more time on coding practice and finish early then every day you do 2 easy, 2 medium and 1 hard problems for each data structure.
Which Data Structure Problem Should I Focus and solve?
Do 50 questions on below data structures. Do 70 questions on Array and Linked List. First solve the problems which are described in the data structure in hindi videos. Then solve others on your own. If you don’t watch videos and try to solve your own in Geek of Geeks you will solve 5 problems. However, if you watch videos and solve them then you should be able to solve 15 problems on your own. Do below Data Structures:
I have gone through Academic Booster channels videos from data structure in hindi videos and created my own GitHub repository. There I added his questions in JavaScript and put his solutions also. This will help you to get started. I have not finished all of his questions. If you are able to finish the playlist and want to contribute to this playlist then please create pull request. I will be happy to integrate.
Which Algorithm Problem Should I Do?
Most of the companies ask Dynamic Programming problems, they are very important.
- Searching - do 50 problems
- Sorting - do 50 problems
- Greedy - do 70 problems
- Dynamic Programming - do 70 problems
If you finish Dynamic programming then whatever Data Structure concepts that you have first finished. There you can optimize your solution using Dynamic Programming.
Where should I practice Competitive Programming Problems?
- LeetCode.com is best for practicing for competitive programing.
- Codechef.com/ is also good.
Participate in competitive problem competitions like:
- Long Challenge: Within 10 days you have to solve problems
- Cook Off
- Lunch Time: Within 2-3 hours solve problems
Do not attempt solving Hard or Medium Problems when you start
When you are a beginner do not start directly with hard or medium problems otherwise you will be disheartened and you may lose your interest to learn coding. Therefore, I would advise not to waste time solving hard problems or mediums. Rather start with easy problems to build some confidence.
I keep forgetting previous solved problems when I do more problems. What to do?
When you will target yourself to solve 50 Array questions and daily you are solving lets say 5 problems. Then you will encounter an issue that you will start forgetting 1st problem solution, when you are attempting 6th one. This is a normal issue and it happens with every student. So do not dis-hearten. I will give you my solution to what I did.
There are some rules that I used to follow to keep myself updated with the problems that I was working on. Let me explain that it may or may not work for you but give it a try since it worked for me.
Before solving problem
Create one Excel sheet or Google Sheet called “Coding Problems”
. Add columns like Problem Statement, Logic, Algorithm Name, Need more practice, category and difficulty level.
Coding Problem Cheat Sheet
Problem Statement | Logic | Algorithm Name | Need more practice? | Category | Difficulty Level |
---|---|---|---|---|---|
Write the problem clearly | Explain the logic in brief | Greedy | Yes | Array | Easy |
During solving problem
Read the question 2-3 times until you kind or memorize or internalize the question. Sometimes, if you write down the question on a paper or white board and read it out loud, that will help you to understand and remember the question. So the point I am making is to understand and remember the question, not the solution.
While solving problem try to correlate your logic with the question, by reading the question again and again since the question has hints for the solution.
After solving a problem
Once you have solved the problem. Open coding problems sheet enter following:
- Problem statement: Write down the problem, remember the very important read each word carefully!
- Logic: Write solution logic in brief ( write as much as you need to remind yourself later time)
- Algorithm Name: Write any algorithm names you have used like Greedy, Binary Search etc.
- Need more practice: While reading this sheet you can mark this yes or no based on how much you can remember problem and its logic
- Category: Write what Data Structure you are working or which Algorithm you are working
- Difficulty Level: Which level you are working on Easy, Medium or Hard
Again before solving a problem
Next time when you start coding then first open this sheet, hide the logic column and read the problems and try to recollect the logic of the solution. If you are not able to recollect logic then unhide the logic column and read it. Next Mark the column needs more practice
as YES
. Next continue reading the next problems and keep updating the need for more practice columns. Once you finish this sheet then only start solving new problems.
Once you do this entry then every time you start coding first read this excel and try to re-collect the problem and its logic on how to solve it. Also if you think you can not remember then solve the problem again, change the logic entry in the sheet such that you can recollect when you read it again. Ideally you should re-collect your solution after reading the entry from this sheet till then keep changing the entry of this sheet to make it very much helpful for you to remind you of your solution. This is your diary for your work.
This is what I used to do to remember the logic of each problem that I solve. You may ask how can I remember 400 questions? So do not worry once you start working on this sheet your brain will be trained such that you will be able to solve many problems without even remembering. However, you have to start doing these notes and read them every time when you start coding practice.
Should I solve all Array problems before starting Linked List problems? What is my strategy for coding practice?
This is an interesting and very important question, comes in everyone mind. It depends where you are. If you are a beginner and you have a good amount of time if not working individually then 6 months and if you are working professional then you have 1 year time or so then you should do each problem from each Data Structure. I personally prefer working with all Data Structures at the same time rather finishing one Data Structure completely before starting another. Example when you start coding for the first time, do one easy problem from each Data Structure ( Array, Linked List, Stack, Queue, Tree, Graph). Next day you pick 2 easy, 2 medium and 2 hard from each Data Structure. Or you keep doing one easy question from each Data Structure. This way you should combine your Data Structure while practicing.
If you are an expert and you have already solved many problems and you want to just sharpen your skills with only one targeted Data Structure then pick that one and work on it. However, this one is only for the experts who had already done 50 problems from each Data Structure and they want to sharpen their skill on targeted one.
If you have any futher question please write in comment box.
Reference
Thanks for reading my article till end. I hope you learned something special today. If you enjoyed this article then please share to your friends and if you have suggestions or thoughts to share with me then please write in the comment box.
Rupesh Tiwari
Founder of Fullstack Master
Email: rupesh.tiwari.info@gmail.com
Website: RupeshTiwari.com
Comments