Practice
Data Structures and Algorithms
Machine Coding Round (LLD)
System Design & Architecture (HLD)
Frontend UI Machine Coding
Resources
Career Advice and Roadmaps
Data Structures and Algorithms
Machine Coding Round (LLD)
System Design & Architecture (HLD)
Backend Development
Frontend Development
Project Ideas for Software Developers
Core Computer Science
Companies
SDE Jobs & Internships
Interview Questions
Compare Companies
IDE
Online IDE
Collaborative IDE

Complete Reference to Competitive Programming | Beginner's Guide

Gaurav Chandak
Gaurav Chandak
Disclaimer: This article was written few years ago and may no longer be relevant as software engineering has changed a lot in the last few years. This is what may be more relevant now: Future of Software Engineering - Gaurav Chandak

This article will help you provide everything that you should know about Competitive Programming as a beginner.

If you already know the basics of competitive programming, you may want to go through the article on 'Roadmap for Competitive Programming from scratch'.

Here are some of the questions that you might have as a beginner in Competitive Programming. We will cover each of the questions one-by-one.

  • What is competitive programming?
  • Why should I do competitive programming?
  • Why should I not do competitive programming?
  • Where can I practice competitive programming?
  • How do I start competitive programming?
  • What is needed to succeed in competitive programming?
  • What are some popular competitive programming contests?
  • Why is competitive programming so hard?
  • Which programming language is best for competitive programming?

What is competitive programming?

Competitive Programming (CP) is a mind sport with one or more logical problems to be solved using programming. Each problem has some specifications which need to be satisfied to solve the problem.

The participants (known as competitive programmers) are required to solve these problems by writing efficient code. Most of the problems in competitive programming are logical or mathematical and may require the use of data structures and algorithms.

Online Judge

In most contests, the solution is automatically verified with different test cases on an online judge. Generally, the solution must also run within the specified time and memory limits to make sure that only optimized solutions get accepted.

Scoring and Leaderboard

Every problem has a predefined score (usually the same) and the leaderboard is computed based on the total score of each participant. Ties are generally resolved based on the total time taken to solve the problems. There might be other factors as well. Many competitive programming contests also add a time penalty for every wrong submission. Accuracy and testing play an important role in these contests.

ACM-ICPC (the Olympics of Competitive Programming) is the most popular competitive programming contest.

Why should I do competitive programming?

You should do competitive programming because it will help you become a better programmer. Competitive Programming is extremely useful as it will help you:

  • Become a better problem-solver and a fast thinker.
  • Learn how to write code fast.
  • Learn how to write efficient and optimized code.
  • Learn how to quickly and effectively debug your code.
  • Take care of edge-cases and become good at testing.
  • Learn how to find out the actual requirements from ambiguous problem statements.
  • Get a huge confidence boost and fame. You might even win some monetary rewards or even a job through some contests.
  • Get your resume shortlisted. If you do really well in Competitive Programming, your resume might help you stand-out as a candidate.

Why should I not do competitive programming?

You should not do competitive programming if you are doing it just for getting a job. For most software engineering jobs, learning DSA and practicing questions that require DSA is enough. Competitive Programming is a good-to-have there. You should do it only if you love doing it. Being a 3-star or 4-star on CodeChef does not matter at all on your resume.

You can read a detailed article on this at Is competitive programming necessary to crack interviews at product-based companies?

Where can I practice competitive programming?

I have listed down the most popular competitive programming platforms where you can practice.

  • CodeChef: Good for beginners, Long contests are a good way to learn and grow as a competitive programmer.
  • Codeforces: One of the most popular platforms. The contests have some really good problems. Practice here for ACM-ICPC.
  • AtCoder: Difficult questions compared to Codeforces. Top competitive programmers hang out here.
  • USACO: Most IOI participants hang out here. Pretty good problems.
  • SPOJ: Huge problem set. Good for practicing during the early days.
  • Topcoder: Was one of the best a few years back. Not very relevant now.

Many people confuse competitive programming with DSA interview prep on LeetCode, InterviewBit, and similar platforms. Leetcoding is very different from competitive programming.

Platforms like HackerRank and HackerEarth are mostly for basic practice and hiring contests. These are kind of like competitive programming platforms.

How do I start competitive programming?

You can start competitive programming by doing the following steps:

  • Start by learning a language (C/C++ or Java)
  • Practice coding on an online platform for warm-up
  • Solve practice problems on CodeChef
  • Start participating in CodeChef Long Challenges
  • Start participating in short contests on different CP platforms

You can go through the more detailed article on this topic here: 'Competitive Programming Roadmap'.

What is needed to succeed in competitive programming?

You need to have grit and patience and are required to do a lot of hard work and practice to succeed in competitive programming.

Grit

Competitive Programming problems are difficult and you may be stuck on a problem for a really long time. It requires a lot of grit and perseverance to sustain and do well in competitive programming.

Patience

While practicing, you need to be patient enough to solve a lot of problems and spend a lot of time in it before seeing any significant improvement in contest performance. Patience is a key skill that you would want to nurture to succeed in competitive programming.

Hard work

It requires a lot of hard work for learning, for practicing and even to participate in a lot of contests. Talent is not enough to do well in competitive programming.

A lot of practice

The most important aspect of competitive programming is practice. Some people practice outside the contests to learn concepts and improve their problem solving skills. Others practice by participating in a lot of contests to do well in bigger contests like ACM-ICPC. You can choose what to do based on your stage and preference. But one thing is for sure that you need to practice a lot.

What are some popular competitive programming contests?

The most popular competitive programming contests are:

  • ACM-ICPC: The Olympics of competitive programming. Open only for college students
  • Facebook HackerCup: Facebook's CP contest. It is also a hiring challenge for Facebook.
  • Google Code Jam and Google Kick Start: Google's CP contests. It is also a hiring challenge for Google.
  • IOI: Like ACM-ICPC but for school students.
  • Codechef Snackdown: Annual CP contest by Codechef.

Why is competitive programming so hard?

Competitive Programming is hard because it is just like any other sport where the best participants in the world compete. Just like any other sport, everyone from a beginner to the best player spends most of their time practicing to up their game. That allows you to make it less hard for yourself by practicing and improving with every contest to do the same.

Which programming language is best for competitive programming?

C++ and Java are the best languages for competitive programming. Most competitive programmers participate using C/C++. Java is the second most popular language for competitive programming. C++ and Java are the preferred languages because of STL and Java Libraries in the respective languages.

Should I pick C++ or Java for competitive programming?

Both languages have pros and cons. Let's look at 3 factors.

  • Speed: C++ is faster than Java but competitive programming platforms provide more time for Java solutions which creates a level playing field so it does not matter much.
  • Functionalities: Java provides a lot more in-built capabilities through which we can avoid writing complex code.
  • Verbosity: Java is more verbose and so it might take more time writing in Java code for simple programs.

I would personally suggest you try out both and decide after using them.

Can I use Python or JavaScript for competitive programming?

You should avoid using languages like Python or JavaScript in competitive programming. Why not?

  • Most problem setters write code in C++/Java. Because of this, most problems are not tested properly for other languages.
  • Many competitive programming contests don't even allow those languages.

Hence, C++ or Java should be your preferred language for competitive programming.

---

I hope that you found this article helpful and have a clear picture of competitive programming now.

Please reach out to me on WhatsApp at if you have any questions.

1
Gaurav Chandak
Gaurav Chandak
Gaurav is the co-founder of workat.tech and has previously worked at Flipkart and Microsoft. He intends to actively contribute to the future of education through workat.tech.
Related Content
Competitive Programming Complete Roadmap (beginner to advanced)
How to solve a DSA problem on online coding platforms? | Leetcode, InterviewBit, Geeksforgeeks, workat.tech
Is competitive programming necessary to crack interviews at product-based companies?
Common Mistakes to avoid in Competitive Programming for Beginners
Everything about online coding platforms like CodeChef, Codeforces, Leetcode, Geeksforgeeks
SDE Bootcamp - Become a software engineer at a product-based company
Practice Data Structures & Algorithms
Learning Resources
Interview Prep Resources
Blog
  • Career Advice and Roadmaps
  • Data Structures & Algorithms
  • Machine Coding Round (LLD)
  • System Design & Architecture
  • Backend Development
  • Frontend Development
  • Awesome Project Ideas
  • Core Computer Science
Practice Questions
  • Machine Coding (LLD) Questions
  • System Design (HLD) Questions
  • Topic-wise DSA Questions
  • Company-wise DSA Questions
  • DSA Sheets (Curated Lists)
  • JavaScript Interview Questions
  • Frontend UI Machine Coding Questions
Online Compilers (IDE)
  • Online Java Compiler
  • Online C++ Compiler
  • Online C Compiler
  • Online Python Compiler
  • Online JavaScript Compiler
Topic-wise Problems
  • Dynamic Programming Interview Questions
  • Linked List Interview Questions
  • Graph Interview Questions
  • Backtracking Interview Questions
  • Arrays Interview Questions
  • Trees Interview Questions
Company-wise Problems
  • Amazon Interview Questions
  • Microsoft Interview Questions
  • Google Interview Questions
  • Flipkart Interview Questions
  • Adobe Interview Questions
  • Facebook Interview Questions
DSA Sheets (Curated Lists)
  • Top Interview Questions
  • FAANG Interview Questions
  • Most Asked Interview Questions
  • 6 month DSA Practice Sheet
  • 3 month DSA Practice Sheet
  • Last minute DSA Practice Sheet