What is Competitive Programming?

What is Competitive Programming

What is Competitive Programming?

Competitive programming or CP in short is a mind game where participants need to write programs to solve well-defined problems. Those problems are mostly related to algorithms, data structures, mathematics, and logic. Competitors’ programs are determined by a variety of factors, including how long the program takes and how much memory the program uses.

There are many benefits to doing competitive programming that I will describe later. If you don’t understand what I just said, that’s fine. I will show you a very simple example of the problem right now.


problem to solve

Here, we have a problem where we are asked to print “Hello, World!” with python. It is very easy for anyone who has a bit of programming experience with python.

So if we go to the code, we just need to type return Hello, World! and that’ll solve the problem.

print hello world

We will click on Submit Code to check if your program is right and will test it in some test cases to see if the program is right.

Problem Solved cp

Your program is accepted and yes, that’s great.

This is a very simple example. The real problem you see in competitive programming will be much more difficult than this. Basically, for each problem, you need to write a program that takes some input and processes the input and outputs the answer.

If you want to try it yourself, this site is called HackerRank and it is a famous site for competitive programming. Also, I used Python in this example, but you can use any language to solve competitive programming problems like C, C ++, or Java.

Now, in competitions, we basically have a bunch of problems that you need to solve. Competitors are usually sorted by the number of problems they solve, the time it takes to solve them, and the number of wrong attempts they make.

Why Competitive Programming?

  • Publicly demonstrate your skills
  • Prepare you well for technical interviews
  • Make you a desirable candidate for major companies
  • Makes you faster and focused
  • Helps you solve complicated problems
  • Guaranteed brain exercise
  • Teaches you to how to work in teams
  • It’s fun

Benefits of CP

First of all, doing CP helps you prepare coding for interviews like FAANG for major companies like Facebook, Amazon, Apple, Paul, Netflix, and Google. The questions asked in coding interviews are basically just medium-to-medium CP issues and that’s why you see so many top competing programmers getting jobs in these companies.

Another benefit, which only applies to high school students, is the Olympiad. The Informatics Olympiad is basically just a CP competition for high school students. Each country has a national competition and training camp, for example, the USA has the USA Computing Olympiad.

Each country selected four students to represent their country in terms of information in the International Olympiad. Winning a medal in the International Olympiad in Information Technology is a great impetus for applying to certain prestigious universities. Some countries also have rules that guarantee your admission to those universities.


Kalpesh Khairnar

Hello Everyone, I'm Kalpesh. Energetic and passionate college student with the ability to work with open-source technologies. I spend most of my time in programming, blogging and helping other programming geeks.

Leave a Reply

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