Everything you need to know about Competitive Programming
Many students are confused about how to get into competitive programming and how to become good at this thing. We will discuss everything about competitive programming along with prerequisites, steps to get started, how to be good in competitive programming, and many more general questions of students.
What is Competitive Programming?
1. Competitive Programming, as the name suggests is the competition of programmers in which their problem-solving skills are checked, and by practicing it regularly, the problem-solving approach and techniques are also enhanced. The participants in such competitions are supposed to write the programs according to given specifications such as which type of input should be given, what should be the output, constraints specific solution, and many more. The problems can be logical as well as mathematical also.
2. These types of programming competitions are organized by many organizations such as “Codechef”, “Codeforces” and a huge number of participants will be there from all around the world.
3. The submitted code is judged by a host machine automatically as soon as you submit the code and it has to pass all the test cases present on the host to be executed successfully. It is suggested to run your code once or twice before submitting it to the host. The code will be accepted if and only if it passes all the test cases. But in a few contests, partial scoring is also present in which marks are allocated as per the number of test cases passed by the code.
Judging criteria in such competitions involve:
1. Number of problems solved by an individual
2. Time taken to write successful solutions
3. Program size
4. Execution time
5. Quality of output produced by the code.
Some important topics for Competitive programming are:
1. Greedy Algorithms
2. Dynamic Programming
3. Strings Analysis
4. Number Theory
5. Graph Theory and many more.
Before going to competitive programming, there are some prerequisites that one must have:
1. Your Programming fundamentals should be good. You can choose any language like C, C++, Java as these are the standard languages that are allowed in every competition, and generally, every company allows these languages in the placement drives. (It’s better to go for C++ because of its speed and the “Standard Template Library” present in C++ makes it easier to code in competitions. Also, the community of C++ is very big because almost every competitive coder uses it as their first choice).
2. Good knowledge of data structures like arrays, strings, stack, queue, linked lists, trees, graphs, hash-maps, etc.
3. Start solving sample problems and practice till you feel comfortable solving them.
What should be our motive behind Competitive Programming?
1. The motive is that our problem-solving skills will be enhanced at will indirectly help us in placements.
2. If we do good in this field, that will help us to stand out from others. It will prove to be X-factor on your resume.
3. It helps you get referrals.
4. The online test round of companies will not feel different as you have already practiced a lot.
Most common and free resources for Competitive Programming
1. Guide to CP book
Complete Roadmap to Competitive Programming
It is a very hot topic among students nowadays so proper guidance is also needed to become good at competitive programming. This will give you a good flavor of competitive programming and it will also help you to use your time productively. So, the roadmap and step by step procedure to become a good competitive coder is as follows:
1. First of all, Standard Template Library / Collections
2. Applications of Binary Search
3. Bit Manipulation
4. Greedy Algorithms
5. Modulo Arithmetic
6. Dynamic Programming (like matrix chain multiplication)
7. Segment Tree (useful for range query problems)
9. Number Theory
10. Start participating in Contests (Codeforces, Codechef)
How you should participate in Contests?
1. While participating in the contests please don’t do this, as the contest has started but I need to go and finish my food or need to do something else. You have to sit down and solve the problems continuously at least for 2 hours and doesn’t matter if you are not able to answer any question but have to sit and try until you have time.
2. Keep pen and paper with you. Try to dry run all your codes and think before you code.
3. Maybe you can solve one or two questions. In the worst-case scenario, you are not able to solve any question in the contest, then also it’s fine. An editorial comes after every contest, have a look at the topic and revise/learn the topic, and try that problem again.
Is Competitive Programming a must?
1. Everyone is doing Competitive Programming. So, do you also have to do it? Is Competitive Programming necessary to get a job? The answer is “NO” because it is not like that if we don’t do competitive programming then we can not get a job. If an individual is comfortable enough with data structures and algorithms that he/she can think which data structures must be used and effective approach clicks in the mind then it is not at all necessary to do competitive programming. It only enhances problem-solving skills. it doesn’t ensure top-notch placements.
2. It is suggested to practice a few questions on competitive programming platforms just to brush up the skills and to grow as a programmer. It also helps to increase the focus and concentration level because the questions on such platforms are given like a small scenario that we have to read to solve.
3. After doing standard problems of data structures and algorithms, one can have some add-ons in the field of competitive programming because it is all about applications of data structures and algorithms.
4. It is also noted that competitive programmers perform comparatively better in the interview rounds of tech giants such as Amazon, Google, Netflix, Microsoft, etc.
Mistakes to avoid as a Coder
We will be seeing some mistakes that most people do and must not be done if we want to have an amazing career in the tech field. We have tried to sum up all possible things that can go wrong and that most people do get wrong so that if we can avoid these mistakes then we will be able to do well.
1. There is a difference between learning programming and learning programming language. What every fresher does is that they think both of these things are the same. If you can learn to program then learning a programming language is very easy i.e. we have to focus on the logic and concepts rather than the language. Take one language and become a master of it.
2. You should not only read and note logic, instead of practice as many problems as you can to build your base strong. Programming is like mathematics, it requires practice.
3. This mistake is done by almost everyone in the starting that they don’t think how to achieve a particular goal with any resource according to what approach. (The resource used must have a concept as well as a practice set for the topic).
4. It’s very difficult to learn when everybody around you is chilling. So, you should try to have a group with similar interests and similar goals. By doing so, it will become easy to concentrate on your goal.
5. Don’t do only DSA and competitive coding throughout your college life. You have to plan your journey accordingly that we will spend a particular amount of time doing DSA, some in Projects and development. Because development is what you will be doing after joining any company.
6. Make short-term goals because achieving small-term goals will boost your confidence and you will find it interesting with time.
7. Don’t just make projects, deploying them is the main and essential work. The moment you will deploy the project, you will get a link that you have made this project and you can now share the project with your friends and relatives. Also, when the link of your projects is present on your resume, it will give you an edge if the recruiter can see a proper working model.
Myths every Competitive Programmer should know
1. It’s too late to start competitive programming. Well, there is no fix age or time to start it. Although it is good to start as early as possible. One can start anytime they feel comfortable with basic data structure and algorithms.
2. There is no such compulsory language to start competitive coding. Although C++ is the most popular one but you can start with any language that you like.
3. Some people think that competitive programming is the only way to get a good software engineering job. It’s not at all true as you can practice for interviews by learning and solving normal questions on data structures and algorithms. As long as you are solving problems, competitive programming is not the only way to get a good software engineering job.
4. The Ranking doesn’t matter during an interview. What matters the most is your problem-solving skills and the approach you have towards a given problem. Whether you are able to give a optimized solution or not.
5. You don’t have to solve lots of competitive programming topics to start participating in contests. You can directly go in the contest and start solving the problems. What you need is the ample knowledge of data structures and algorithms and also strong concepts of the language that you code in.
These were some most common things regarding competitive programming that one should know before jumping into it because knowing these points already will save your time and you will not start with zero if you have all these points in your mind. At last, we can conclude that competitive programming is not essential it is just a way to improve and enhance your problem-solving skills and it makes you familiar and more conceptually strong as you have applied the concepts in different problems with different approaches without actually knowing that you used them indirectly in order to achieve the desired output.