Programming… Competitive Programming…
It teaches you how to think?. If you are a programmer you might have understood the deep meaning of these lines quoted by Steve Jobs and you might have also experienced that even after shutting your computer you keep on thinking about programming stuff or code you have written in your project. Once you enter in programming you just don’t learn how to code but you also learn the “art of thinking”, by breaking your code into smaller chunks and then using your logic-based creativity to solve a problem from different angles.
Programming is fun, programming is an exercise for your brain, programming is a mental sport and when this sport is held over the internet involving sport programmer as a contestant then it is called Competitive Programming. Check what Wikipedia says about Competitive Programming.
Why you should prepare yourself for this game and participate in it?
Programming is a challenging role and once you enter this field you will encounter new challenges and you may have to solve some problems which no one has solved before or their solution doesn’t exist anywhere. At that time you are expected to come up with a solution in the least possible time using your problem-solving and logical ability. So the one and clear goal behind these competitive programming is “To prepare a programmer such that his/her logical ability increases and he/she is able to write code for the challenging situation.”
Another reason is that a lot of big companies like Google, Facebook. Microsoft, Amazon hires through competitive programming so if you want to get into these companies then you really need to get your hands dirty in competitive programming. It doesn’t matter you are a newbie programmer or you have written some code before, we will tell you some steps, approaches, and tips to prepare yourself for competitive programming. Let’s discuss that in detail.
Keep in mind that you need to be proficient with the following:
- Any programming language syntax (Choose any but highly recommended C/C++/Java).
- Time and space complexity algorithms analysis.
- Ability to think about a Brute Force Solution.
- Good practice of all Data Structures like Array, List, Stack, Queue, Tree, Graph, Trie etc.
How to prepare yourself for Competitive Programming?
1. Choose a Programming Language: Firstly, you need to choose a programming language that you are most comfortable with and learn its syntax. It can be anything C, C++, Java, Python or any programming language. Programming languages are a tool through which you can communicate to the computer and instruct what to do. C++, C or Java is a faster programming language in comparison to any other language also it is allowed to use in any coding challenge or interviews. So it’s good if you choose one out of these three still there is no restriction if you are comfortable with another language. If you are beginner you can go with python because it’s easy to learn and syntax are user-friendly. If you have at least intermediate hold on the anyone programming language you won’t face difficulty in writing the code using the syntax of it.
2. Understand the Concept of Time and Space Complexity: In most of the cases there is more than one solution that exists to a problem so you need to come up with the best solution i.e optimal one and that’s decided by how much time and space an algorithm takes to solve a problem. So it’s really important to learn about these two concepts to write an optimal solution for the problem.
3. Learn the Fundamentals of Data Structures and Algorithms: DSA is the heart of programming and you can not ignore it while solving coding problems in competitive programming. Array, Linked List, Stack, Queue, Tree, Trie, Graph, Sorting, Recursion, Dynamic Programming all these basic building blocks of DSA will help you to become a good programmer. The most important thing you need to know what, when and where to apply them. It means which data structure is suitable for what type of problem to get the optimal solution. You should know how to apply a perfect combination of both in the coding problem.
4. Take the Challenge and Solve Coding Problems: You have learned a programming language, you have learned time and space complexity and you have also covered the fundamentals of DSA, now it’s time to take the knife in your hand and kill the lion in the jungle. Yes…you need to take part in coding challenges on different coding platforms. Before participating in contest it would be great if you practice for some challenges on your own and then participate there. If you are looking for the resources of these coding platforms so alot of sites are there like Codechef, Codeforces, Topcoder, SPOJ. Here is the complete list of these sites on freecodecamp.
Start from the basic level on these sites and once you build the confidence, get out of your comfort zone and gradually try to solve the complex problems. Below are some points you need to keep in mind once you start solving problems on these sites…
- You need to understand the input, output and test cases on these platforms. Check the link Solving Problem on Codechef to solve coding questions on these platforms.
- These platforms run your code on a lot of inputs then take out the output and store it in one place. They also have the authors code and the authors code is the correct code of the problem. They run the same set of input on authors code and create the outputs and after that, they match these two outputs. If these two outputs match then your solution is considered as accepted and your code should pass all the test cases to get accepted.
- You may freeze out in the beginning once you see the problems on these coding platforms and think that you are not made for it or your thinking ability is not much higher to solve these questions. The reason is as a beginner you just know the syntax of the language and some basic loops or function, so when you encounter these challenges you freeze out and start doubting on your capabilities which you should not do that. You need to understand that there is a process to learn competitive programming and you have to move gradually from level 0 to the top level.
5. Practice and Do it Regularly: Your patience, dedication, and consistency are very important to become a good competitive programmer. Keep practicing the coding questions every single day on these platforms or you can also take the help of whiteboard to solve coding questions but the important thing is to do it regularly. Do not make a mistake to take a break from it once you start. Stick on it, no matter how difficult the problem is or how much time you take to solve a single coding problem. Participate in different coding competitions and learn from other programmers. Your daily practice makes you a perfect coder, good problem solver and you will be able to find a suitable data structure for a specific problem and that matters a lot in software development.
- As a beginner in competitive programming is like giving a paper of IIT to 5th or 6th standard student and then asking him to solve the questions. You will be feeling like the same once you know the syntax, loop, function, and everything but you are unable to solve those coding problems and that’s completely okay. Understand that every beginner go through this phase.
- Higher the submission is, easier the problem is on these coding platforms so you can sort these question by a number of people who solved it.
- Create communities and try to find like-minded people who have different skillsets so you can learn from each other, also if you are in college then make a team and participate in ACM ICPC.
- You can download one of the application Code Buff that will help you a lot in getting the notification of competitive programming coding contests happening across so many different platforms. It also allows the user to set a reminder.
- To jump in competitive programming you can follow an approach of project-based learning in which, once you know the syntax of the language and basic fundamentals, you can create multiple challenging projects and after making a lot of projects you will realize how logics work in development and that will help you to increase programming ability. After that, you can move to competitive programming and you will realize handling those questions of competitive programming is easier now and now you can do very well.
Programming really needs a lot of patience, so don’t get discouraged or DO NOT GIVE UP IF YOU GET WRONG ANSWERS. This is the point where most of the people lose interest in programming. Keep trying for a day, week, months if a voice inside your head says that your method is right. If you can’t find a solution google it, ask for help if you don’t get the topic, read the various approaches that coders took to solve the problem but don’t quit. Also, you can read the solution only if you are completely sure that you have made a lot of effort and now you can’t do anything. But make sure to code again the same problem. You will start improving day by day only and only if you maintain your consistency and don’t stop.
The biggest mistake programmers make is probably getting discouraged and not practicing enough. Or practicing only on problems they feel they’re good at.
– Derek Kisman, aka SnapDragon
- Tips and Tricks for Competitive Programmers | Set 2 (Language to be used for Competitive Programming)
- How can competitive programming help you get a job?
- Which C++ libraries are useful for competitive programming?
- A Better Way To Approach Competitive Programming
- Fast I/O for Competitive Programming
- Bit Tricks for Competitive Programming
- C++ tricks for competitive programming (for C++ 11)
- Must do Math for Competitive Programming
- How to begin with Competitive Programming?
- What Are The Best Resources For Competitive Programming?
- How to become a master in competitive programming?
- Python in Competitive Programming
- Fast I/O in Java in Competitive Programming
- Setting up a C++ Competitive Programming Environment
- Interactive Problems in Competitive Programming
- Which Python Modules are useful for competitive programming?
- Interactive Problems in Competitive Programming | Set 2
- Some useful C++ tricks for beginners in Competitive Programming
- Competitive Programming: Conquering a given problem
- How to read Competitive Programming Questions?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : adityanathloyola