What is competitive programming ? How to start competitive programming ?

Rajveer Choudhary
5 min readOct 15, 2020

Welcome guys… here is our new blog in which I am going to write an introduction to competitive programming world and how a beginner/fresher can start competitive programming.

What is competitive programming ?

According to Wikipedia, “Competitive programming is a mind sport usually held over the Internet or a local network, involving participants trying to program according to provided specifications”. Overall Competitive programming is solving well-defined problems by writing computer programs under specified limits.

To understand more about competitive programming. I have an example which is written by Anthony-Moh on quora.

You are in the jungle. You have a pocket-knife. Someone asks you to kill a mountain lion. Anyone but a programmer would be asking “WTF is a MOUNTAIN lion doing in a JUNGLE?!”, but that’s not what you have been trained to do as a programmer. You are here to solve problems, not to question them.

Years of training has taught you well. You use your knife to sharpen a stick. You cut vines to lash sharp stones on one end. Maybe you’re from a top university, and you’ve learned to extract essential ingredients from plant and insect life around you to fashion a poison to tip your weapon with.

Convinced that you have an effective and efficient way to kill the lion, you set forth to accomplish your task. Maybe your stick is too short, or your poisons don’t work. It’s okay — you live to refine your method and try again another day.

Then someone figures out a way to fashion a low-grade explosive from harvesting chemicals in the jungle. Your method of fashioning a spear to kill the lion is now far from the best way to accomplish your task. Nevertheless, it’s still a simple way, and will continue to be taught in schools. Every lion-killer will be taught how to build his tools from scratch.

That’s “real-life” programming.

In competitive programming, you start out with the same resources (a pocket-knife), except you have 2 minutes to kill the lion.

As a beginner, you will stare at the lion and do nothing.

Soon, you learn that if you kill a squirrel, sometimes the judge thinks it’s a lion and you’re good to go.

A more experienced programmer just keeps stabbing the lion and hopes that the lion dies in time. Soon, you learn that there are certain spots on a lion that are damage immune. You learn to not even bother stabbing those spots. Sometimes, the lion doesn’t expose those spots, so you get really good at killing squirrels.

And then, to be a great competitive programmer, you need to be able to do two things.

First, you must learn how to find the lion’s critical point and kill it in one swift stroke.

Second, you must learn how to be so handy with your knife that you can fashion a sharp stick in 1 minute, and spend the next minute stabbing the lion to death. But never ever will you be able to have enough time to fashion an explosive to take the lion out.

Overall whole summary of this example is competitive programming is just as analytical skill in which you have to solve the problem in given or limited amount of time. So now I am assuming that you have understood things.

How to start competitive programming ?

There are few steps in which I will describe that how can start the competitive programming

Step -1. Choose any programming language.

You have to first choose any language in which you are going to start competitive programming. I will recommend you to choose C++. It has two reasons first one is the popularity of C++ in competitive programming world. Most of pro competitive programmer use this language or another reason is its having reach library which helps us to solve problem easily like STL(Standard Template Library). Either you can go with java as well this is another choice of competitive programming world.

Step -2. Learn basic data structure.

After choosing your languages of choice, you need to review the fundamentals of data structures. Understanding data structures and algorithms are the heart of competitive programming, as they are the way to solve the problems you are given. There are various platform like hackerrank, hackerearth where you can practice of easy questions which having basic data structure concept like array, string ,linked list, tree and graphs.

Step -3. Learn Algorithms and practice !

After taking basic DSA knowledge you have to move on learning the algorithms which play the vital role in competitive programming. At starting learn basic algorithms like searching (binary search), sorting (quick sort, bubble sort, merge sort). Solve questions on the hackerank, hackerearth or geeksforgeeks using this kind of algorithms.

Step -4. Understand time and space complexity.

Beyond just knowing the concepts, you need to know what, when, and where to apply them. This means knowing which data structure should be used for a certain problem for the most optimal solution. You’ll need to understand the concepts of time and space complexity, like Big O Notation. This is key when being a competitive programmer because much of your placing revolves around how quickly you can solve the problem.

Step -5. Apply 3-P technique( Practice, Practice and Practice ! )

The mantra to become pro competitive programmer is just doing practice and spending time on solving various problems. Practice on problem using dynamic programming , recursion when you cover easy questions. now participate in codechef and codeforces challeges and sharpen you competitive programming skills.

What are the benefits of competitive programming ?

There are lots of benefits of competitive programming some of which I mentioned below

  • Makes you a desirable candidate to tech giant companies like Google, Facebook.
  • Makes you faster and more focused.
  • Helps you solve complicated problems.
  • Teaches you how to work in teams.
  • Training and participation helps you prepare for a career in coding.

There are more things to learn and don’t stop just learn the those things which you helps in solving problem. There are lots of tutorials for competitive programming on the youtube. I just cover up the starting journey of competitive programmer you have to go more…

Thank you guys… :-) . This is from myside for today and will meet soon in our next blog

--

--

Rajveer Choudhary

Full Stack Engineer | Tech Blogger | Mean Stack Developer