A Head Start to Competitive Coding

Samyak Jain
Mozilla Firefox Club VIT Vellore
4 min readJun 1, 2021

To many, competitive programming isn’t just about typing out code. It’s a sport that takes years to master and become fully adept at. In fact, competitive programming isn’t just a hobby. Participating in competitions has numerous benefits: getting a job, improving logical analysis skills, expanding your creativity and many more.

Anyone who does competitive programming can enhance his/her problem-solving approach. In this article, you will be learning how to approach a problem in the best of the best possible ways, how to analytically think and solve a problem and analyze its space and time complexity.

How to get started with Competitive Coding?

Choosing a Language:

Well, you can choose any programming language for CC. The major languages that come to mind when talking about CC are → C, C++, Java, and Python. But the Pro Coders (as one might say) prefer either C++ or Java. The reason behind it is that the execution time is very less as compared to other languages. C/C++ and Java are relatively faster, particularly when compared to languages like Python. It's recommended not to use python as the language due to its execution time factor as it's very slow as compared to other languages. Well, I prefer Java because I love it. I never really liked C++ syntax that's why I never gave it a try. But, you are free to choose any language and you might end up loving it!

Choosing a Platform to Practice and Participate:

As a beginner, HackerRank is the best place to learn and practice. It has a very good UI and a number of problems for almost every topic which is sorted according to their difficulty level.

The main thing that HackerRank provides to the users is that if you get stuck on some problem for a very long time and only passing some of the test cases, then you can download the test cases and you can review your logic to do some modifications. It will help in thought process in order to be able to think about corner test cases.

But, considering the test cases, they are good at a beginner level. After a good practice of say 2–3 months (assuming you are consistent) you should be able to think and identify the test cases which might not pass.

After getting confident enough in the basics, one can join the major leagues of CC (i.e. Codechef, Codeforces, etc). Here you will find competitions happening every now and then, the key thing is to participate in these events even if you think you might not be able to solve the problem. We’ll be talking about this shortly.

Data Structures and Algorithms:

As you will start participating in different competitions, you will know that just knowing the programming language is not enough for CC (Well, Happy Realization). Knowing Data Structures and Algorithms is a must.
You might have seen that there is a time and space limit for executing a program when participating in a coding competition. That is, actually the Time and Space Complexity of the given Algorithm.

Every algorithm has a Time and Space complexity which refers to the maximum amount of time an Algorithm will take and the maximum amount of memory an algorithm will require. While doing Competitive Programming these two will play a key role in determining the verdict of your solution. Always try to think of the most optimal solution: one that runs with the least time complexity and occupies minimum space.

That’s the Power DSA gives to you. You just have to think about which data structure will work most efficiently in the given problem statement and apply it to the given problem. But for that, you need good knowledge about which data structure has what pros and cons and which algorithms have what plus points and minus points.

GeeksForGeeks(GFG) is the best platform to learn Data Structures and Algorithms. It contains a rich amount of tutorials, materials, and problems based on Data Structure and Algorithm and it is a one-stop solution for DSA.

Competitive Coding Essentials:

Patience:

The most important thing you need in competitive coding is Patience; both during the competition and while practicing. Anyone who starts competitive programming as a beginner faces impatience, and the reason behind this is that he/she is not getting the AC (Accepted/Correct Answer) on some problems even after trying that problem for 2 or more days, and this leads to the impatience.

Participating in Coding Competitions Regularly:

Participating in contests regularly benefits a lot even if one is not able to get/run all the problems completely. By participating, you learn the different topics on which the problems were based. You know which topics you have a good grasp of and which you don't and then you can accordingly work on them. One can actually do a complete SWOT analysis by participating in different types of competitions.

You get experienced in how to fight with programmers from across the globe.
But here’s a trap, as a beginner, one might find all the ranks and stars very intimidating and might end up getting a lower rank. But make sure you don't give up because patience is the key. As a beginner, it is a must to face some difficulties because that’s where you learn from. As you practice more and more participate in as many competitions as you can, and eventually you would get better and better in competitive coding.

Congratulations on making it till the end! You now have the patience and passion to code and you might be strongly willing to start competitive coding. So, what are you waiting for? Start right now! Besides, if you want to know what a coding competition is, we have a CC Event waiting just for you → MozCode: A Maneuver for the Zealots of Coding

Good Luck for your future endeavors!

--

--