Contents
Competitive Programming is one of the few buzzwords that students in tech get to hear on daily basis. For some, it is a way to get a Software Engineering job at good product-based companies like Google, Microsoft, etc., for some, it is a sport that they love to play.
In this article, I will share how exactly you can start CP(Competitive Programming) if you are a beginner and also give you the path through which you could get an intermediate level in CP.
What is CP(Competitive Programming)?
In one word I define CP as a “Programming Sport”. Competitive Programming is a programming contest. Contestants compete for solving real-world programming-based questions asked in the contest in the most efficient and quickest possible way.
Usually, contests can happen for a time duration of 45mins to 3 hours. It may consist of 3 to 6 real-life-based programming problems with crucial constraints. The contestants who can solve the problem such that it passes problems constraints and all test cases, get accepted by the online judge. Ranking gets decided on the time taken to solve the problem. Each problem carries some points depending on the level of its difficulty.
Some best CP platforms are Codeforces, Topcoder, AtCoder. Some very well-known top CP programmers are Gennady Korotkevich, Kamil Dębowski, there are many you will know by yourself when you start CP.
Master 1 Programming Language
Before you can even start CP, you should be good at programming with at least 1 language. You can pick any language and master it. You really need to have a good catch over 1 programming language. In CP programming language is just like your tool so it becomes important to pick the best tools when you go for a fight. The key is to master any 1 language.
In CP time constraints is plays a very crucial factor in deciding the ranking of the contestant during a contest. Programming languages have different execution speeds based on how they are built. For example, Python has a greater execution time than Java, and C++ has the least execution time as compared to Java or Python.
Also, apart from looking fastest programming language in terms of execution, we should also take care of its community. The wider the community it has the better support you can get.
You can pick any programming language, it would not create much difference but most of the CP guys do CP in C++. Because C++ has the great advantage of fast execution time, big community, and STL(Standard Template Library) which has a collection of Data Structures and Algorithms which you can simply in your program.
Learn DSA
DSA stands for Data Structures and Algorithms. In CP, to solve any problem you require some data structure and then you write your algorithms to solve the problem. It is important for you to have a good understanding of all Data Structures and important algorithms.
You should be able to implement all data structures from scratch. Although this is not required as you get all these in STL or collections of the Programming Langauge. But it is very important for you to know how all these work, so you should learn this by heart. Don’t skip this step.
Some important Data Structures are Array, Linked List, Stack, Queue, Tree, Graph, etc. Take enough time to learn all these data structures and solve a few basic questions based on each.
Some important Algorithms are Sorting algorithms (quick sort, merge sort, etc.), Searching Algorithms (binary search, linear search, BFS, DFS, etc.),
Practice Problems
Once you complete the above step 1 and 2. Then you are all set now. Now you can start practicing more and more problems. You can leverage coding platforms like LeetCode, GeekForGeeks, InterviewBit, etc. Start with an easy level. Solve 100 to 200 easy-level questions on different topics, then you can move to the medium-level questions, and once you gain enough confidence you can solve hard-level questions as well.
The important thing here is consistency. It is better to solve 1 question daily for 30 days rather than solving 30 questions in a single day and then solving it after many days. At the initial level, you can try to give as much time as possible to solve questions. Once you become intermediate then you can even solve 1 question a day with consistency.
Give Contest
Now, you have done all the above points and you have good confidence in your problem-solving and DSA skills. Now you should start giving contests. You will not get good ranks or ratings initially obviously but don’t get sad about it. It is an obvious thing. Once you give enough contests you will start gaining ratings and rankings on the leaderboard.
The best part of giving a contest is now you have a time limit to solve problems in at most efficient way too. Leetcode has a weekly coding challenge you can start from that. And best CP platform is Codeforces. There is a big community of CP people and if you perform well in a contest you will become a star in the community.
- Some great contest CP platforms are:
- Codeforces: Contests usually happen for a duration of 2 hours and you may get around 5 to 7 questions. Around 15k to 25K users give this contest. These contests used to happen once or twice a week.
- LeetCode: Leetcode has a weekly contest on Sunday. Leetcode’s contests are beginner friendly as well.
- Google:
- Google Kickstart: It happens every year for several months. One contest every month. Here if you perform well and come in the top 100 ranks, you may get an interview opportunity at Google.
- Code Jam: It is Google’s longest-running global coding competition. It happens every year. The price amount is $15,000.
In giving contest the important thing is we are working on time. We are trying to take the least time to solve any problem. So forget about losing ratings or rankings on these CP platforms just be consistent to improve the time you take to solve problems.
yay!! finally, you did it. You can put your ratings/rankings on different CP platforms on your resume as well.
Hope you like this article, if you have any questions or queries you can reach out to us on through Twitter, or email.
Next Read: How to Become a Software Engineer
Software Engineer. I like to help people with my articles. I hope you like them.
Leave a Reply