Then, I discovered CodeChef. It is a widely used online competitive programming (CP) platform. It provided me with an opportunity to delve into a side of programming I didn’t know existed. Once I understood how the website worked, it had me hooked. I was at problems for hours aiming for the all satisfying green tick AC (all correct) verdict. When I decided that the problem required concepts I hadn’t learnt yet, I could always refer to an editorial and learn new and interesting ways to solve it. CodeChef Discuss has a good community of programmers willing to help in debugging. It’s similar to StackOverflow, but specific to CP.
Now you may ask, what is ‘competitive’ programming? You must have heard of programming and coding in recent times, and that you can write code using programming languages like Python, C++, Java etc. But, how can it be competitive? Are there competitions that are held for this? How different is it from normal programming, the kind used to make applications and websites for hackathons? These are some questions that I aim to answer here.
Programming is all about problem solving. Competitive programming just takes that to the next level. A problem is explained in detail and a story is often woven around it to make it easier to understand. You are told the format of the input that your program is expected to read in and the constraints, i.e., the upper and lower limits of the input values, are listed. Then, the expected output format along with some sample test cases are described. You can see an example of a basic CP problem here.
The programmer’s task is to write code in the language of their preference, which will do some operations on the input, and produce the desired output in the minimum possible time. The questions can have numerous correct solutions and sometimes revolve around a concept in mathematics, like geometry, number theory, permutations and combinations etc. Most often, the problems require knowledge of data structures and algorithms (DSA) and dynamic programming (DP) to come up with a fast enough solution.
If you have been programming for a while and feel like you’ve written many programs and are out of ideas on what to do next, competitive programming can act as a good way to level up your problem solving abilities and is a flexible activity you can do when you are free. It also tests your creativity, by challenging you to come up with creative solutions that handle the general as well as the edge cases (such as dividing by 0 which would throw an error) in the best possible way.
It helps you get extremely familiar with the syntax as well as builds an intuition to identify what a problem is asking and choose an approach to write solutions, that are more time and memory efficient. This is a very important skill which many IT companies, including FAANG, test through coding interviews when recruiting software engineers. Google even hosts multiple online programming competitions such as CodeJam, Kickstart and Hash Code. CP competitions are a common event in inter school technology symposiums too. International Olympiads such as the IOI (high school level) and ICPC (college level) are focused on CP.
Unfortunately, many students only realize the significance of competitive programming once they enter college. This is often a bit late and if you have been programming in high school, CP is the best way to code regularly, learn DSA and get a head start.
There are many YouTube channels which can guide you on your path to starting CP, and there are thousands of sample problems on websites like CodeChef, Codeforces, Atcoder, Leetcode and Hackerrank, where you can code and submit solutions to any problem.
Hopefully, I have managed to spark an interest in competitive programming in you. If so, click here to find a well-illustrated guide that can help you get started. CodeChef has a brilliant curation of all the resources you will need to learn and apply the basics of DSA.
If you ever have any doubts regarding competitive programming or want to discuss a problem, feel free to reach out to me at firstname.lastname@example.org and I’ll be sure to respond.
7% of viewers liked this article!