How to get started with Competitive Programming

Competitive Programming is a mind sport where participants need to write programs to well-defined problems related to algorithms, data structures, math, and logic judged by many factors like how much time and memory programs use. Now let’s see how to start with CP?

  1. Learn a Programming Language:

You should be familiar with at least one programming language to start with Competitive Programming (CP). Common Programming languages used for CP are:

  1. C++
  2. Java
  3. Python

CP is not all about writing code, it is writing optimized solutions for a given problem. Different programming languages provide us different ease.

For example, C++ has the fastest execution time when it comes to CP. It provides incredible STL support. It is the most preferred language by world champions. Python is slow as compared to C/C++ and Java, that’s why very few programmers do Competitive Programming in Python. Although Python is good for beginners, you can switch to C++ or Java afterward.

2. Choose a Platform:

Once you are comfortable with the basic syntax of your preferred language and are used to write programs in that language then you are good to start your journey with CP.

Choosing a platform to practice and learn isn’t a big problem because there are many online platforms, but where people get confused is which platform they should start with. Before you start, you should know where do you stand?

a. Beginner (Familiar with Basic Syntax): HackerRankHackerEarth

b. Intermediate (Building Logics): CodeChef

c. Advance (Time-efficient Problem Solving): CodeForcesLeetCode

You should never stick to one platform, try to switch to other platforms when you get familiar to that particular platform or when you want to upgrade your level/ type of questions.

3. Master DSA:

As said, CP is not about writing a solution of a problem but writing an optimized solution for it. You can only think of an optimized solution when you have a good command of Data Structures and Algorithms. Otherwise, you will see that your logic is right but you are facing a time limit or memory limit error.

Why is it so important to optimize your solution?

When you search for any ID on Instagram, you find the results in microseconds, how? Will the computer search for that ID by comparing it with each ID? Of course not, this will take a lot of time. That is why we need to think for any optimized solution and that is where choosing an appropriate data structure or algorithm is important.

You can learn and practice DSA on Geeks for Geeks.

4. Practice:

Consistency in practice is very important. Days will come when you feel you’re not able to get the right approach or even if your logic is right you get errors but don’t give up there, see editorials, search for other approaches, learn new concepts. When you are not able to solve any problem, try to learn a new concept, a new algorithm. Always keep yourself motivated enough to solve the problem, it will help you in enhancing your problem-solving skills.

5. Participate in Contests:

You should regularly participate in coding contests to know where you stand and also coding contests help you to solve a particular number of problems in a given time which helps you to increase your time efficiency. Coding contests are held weekly and monthly on different coding platforms, varying from few-hour contests to weeks. Some of the coding contests are:

  • Cookoff, Lunchtime, Long Challenges on CodeChef
  • Weekly, Biweekly Contests on LeetCode

And there are many other Contests on different Platforms.

CP is a lot more than these 5 points, it is an experience, so what are you waiting for? Go and get your hands in CP.

Want to know more about CP? Check out these videos and channels:

  1. Gaurav SenHow to start Competitive Programming?
  2. William Lin: What is Competitive Programming?

Read more posts here

Leave a Comment

Your email address will not be published. Required fields are marked *

x