Technology
Navigating the Journey to Competitive Programming
Navigating the Journey to Competitive Programming
Hi, the goal behind me writing this guide is to help as many students as possible navigate their journey from starting out in programming to becoming a hard-core competitive programmer. Let's dive into the world of competitive programming and explore how you can make the most of it.
What is Competitive Programming?
Competitive Programming is a programming sport involving many participants competing with each other to achieve better results. It helps enhance one's mind and develops analytical and thinking skills. Competitive Programming is more common nowadays than ever before, with an active competitive online community and a variety of competitions taking place every week. The competition difficulties are also on the rise, making it essential to be well-prepared.
Benefits of Competitive Programming
Here are the benefits of competitive programming:
Competitive programming helps you to improve your logical and analytical skills.
It improves your algorithmic knowledge.
It is an excellent addition to your CV.
It helps you improve your network of friends who are also passionate about programming.
It is supported by world famous organizations like Google, Amazon, Facebook, IBM, and others.
How to Get Started with CP
Let's break down the steps to start your journey in competitive programming:
Prerequisite: Determination/Dedication
First and foremost, you need determination and dedication to succeed in competitive programming. This requires a lot of practice and a willingness to learn.
Step 1: Choosing Your Language
While you can choose from a variety of languages, it is recommended that you start with either C or Java. Due to the time of execution, C and Java are preferred over Python, as Python may not be available on many official coding platforms like ACM ICPC. The time of execution is a critical factor here, as it can give you an advantage.
Step 2: Learn the Language
I would recommend practicing problems as much as you can. This will help you to learn as you go. Start with any YouTube playlist like Python for Beginners. For languages like C and Java, focus on basic concepts like if/else loops, arrays, functions, and the standard library for math, string and array operations, and input/output.
Next, go to HackerRank and solve problems based on the language you've chosen.
Step 3: Start with Problem-Solving
There are many excellent platforms for starting out in competitive programming. I advise beginners to start with HackerRank and Atcoder. These platforms contain the easiest-to-use IDE and tasks for learning and honing basic problem-solving abilities as well as mastering the language.
Other platforms such as Codeforces, CodeChef, TopCoder, HackerEarth, LeetCode, SPOJ, and Project Euler are also strongly recommended. Personally, I believe you should choose any one of these websites and stick with it for a while. Don't jump around.
I also used to solve questions on Codeforces initially. I recommend beginners to sort out the problems based on the number of problem submissions and solve the first 3-4 pages. This will give you a good introduction to competitive coding. Start from the most solved problems and keep going. Generally, A problems would be the easiest, followed by B, C, and D. Remember, you are in Division 2, so problems labeled as Div1 A are equivalent to Div2 C. You might end up doing a very difficult 'A' problem.
As a newbie, you should never care about your rating because that is your biggest barrier in trying harder and solving problems out of your comfort zone during a competition. Even if your rating goes down, it doesn't mean you are not improving. Rating is relative to others and is not a sole factor of what you can do. The key is: PRACTICE. Don't stop even if you get stuck. Get help immediately.
For example, try to find other peoples' solutions or read the editorial. Get the main idea of the solution. Now close the solution and implement your own without reading the solution again. This is quite important so that the algorithm/solution will sink into your head.
Step 4: Learn Data Structures and Algorithms
To move forward as a competitive programmer, Data Structures and Algorithms will be your long-term partners who will help you solve problems with low time and space complexities. To become proficient, you should learn about time complexity analysis.
The time complexity of an algorithm is the algorithm’s amount of time to complete its process as a function of its input length n. The time complexity of an algorithm is commonly expressed using asymptotic notations such as Big O, Big Theta, and Big Omega.
Here are some important online courses you can explore:
Logicmojo
Scaler
Educative
Data Structure is a way to store and organize data so that it can be used efficiently. While solving a problem, knowing which data structures to use can make a significant change in time complexities and decide your solution's fate. Here are some important data structures to learn:
Arrays
Linked Lists
Stacks
Queues
Binary Trees
Heaps
Graphs
Tries
Here is a list of popular concepts for competitive coding:
Searching
Sorting
Mathematical Algorithms
Graph Algorithms
Greedy
Divide and Conquer
Dynamic Programming
It is essential to constantly learn and also revise programming concepts such as data structures and algorithms. It is recommended to follow a simple rule: For every 3 hours of problem-solving, allocate at least an hour to learn concepts.
Step 5: Participate in Contests
There is no better practice than actual contests. Contests help with your ability to contain your stress and will test your strengths to the maximum. After each contest, make sure to solve all the questions that you did not solve during the contest. This is a key point.
Let me define “Stuck” for you. Stuck is a state when you have completely tried your level best, all ideas you have had have failed, and you can't think of more. Your rating doesn't matter. Once you put your rating to a side, you will be more aggressive in solving. Rating would automatically improve as you improve.
Once you are comfortable with A and B level problems, try pushing for C, then push for D. Don't stop. Push harder. You'll definitely be good someday.
Participate in Prestigious Programming Contests
As a competitive programmer, you can aspire to participate and win global-level challenges and represent your college or country. These competitions allow young, talented programmers to measure their capabilities and compare themselves with other programmers worldwide.
ACM International Collegiate Programming Contest (ICPC)
Google Code Jam
Google Hash Code
Google Kick Start
Microsoft Imagine Cup
Facebook Hacker Cup
The International Conference on Functional Programming
Conclusion
Competitive coding has been both fun and a source of frustration, but the former is dominant. I would think that programming entails more than just writing a few lines of code. Code debugging is the real deal. You are an expert at coding if you are skilled at debugging. And you really need a lot of experience and dedication to become an expert in debugging. I am thankful to Logicmojo for providing me with the right material, assignments, and tests to keep me engaged till I did not learn. It takes a considerable amount of time before you get good at it. You have to keep yourself motivated throughout. Forming a team and practicing is a good choice. All the best!!