Table of contents
- Some Do’s and Don'ts
Competitive programming is a brain game, which challenges you to code a given problem statement while keeping the constraints in mind.
Today we will be discussing what is Competitive Programming, the myths surrounding it, and what should be your focus while thinking about preparations for your interviews.
Competitive programming is a perfect way to level up your programming game.
The easiest approach to be seen by top product-based companies and land interviews there is through competitive programming, however, the questions are:
How to get started with Competitive Programming?.
Which website is good if you are new to programming?
What are some websites and what are the contests to participate in and compete with others?
Before discussing these questions, first, let's dive into what competitive programming basically is?
What is Competitive Programming?
Competitive Programming is a mind sport where you are given some problem statement and you need to come up with an optimized solution under a few constraints by using your programming abilities. This sport tests your Logical thinking, Analytical Thinking, Pattern Recognition, Pressure Handling, and most importantly your knowledge of Data Structures and Algorithms.
Check what Wikipedia says about Competitive Programming.
Competitive programming teaches the art of breaking a problem into small pieces and making working solutions for them.
Competitive programming or CP might therefore be categorized as a sport or a mental game. In CP, you are given a problem and asked to come up with a solution that, given any input, should lead to the desired result. The algorithmic approach must be developed along with the associated code, which must then be submitted. CP requires the use of logical reasoning, analytical reasoning, pattern identification, and—most importantly—programming skills to meet that task.
Competitive programming is often easier to comprehend when compared to other programming paradigms. There is no requirement for clear variable names or well-documented code. But that doesn't mean you should code carelessly just because you might have to debug it if it doesn't work.
How to get started with it. This is probably the most nagging question at the back of your mind once you have decided that you want to learn how to program. Like learning anything else, there is no standard process for learning to. Of course, there are guidelines, there are courses, there are ideologies, and there are set traditions, but there is no one correct way.
What are the prerequisites?
There are no prerequisites as such.
Now let’s talk about how to excel at this sport or what skills are required to excel in it?
- You need to be good with some Programming Language.
You need to have a basic knowledge of Data Structures and Algorithms
You can learn the basics of any programming language like syntax, some basic DSA like Arrays, Strings, and algorithms like Sorting and Math. After that, you can start solving the questions and learn new concepts while solving the questions.
Now lets talk about the step by step guide of getting started with Competitive Programming? Here are some steps to help you get started and be good at it.
Step-1: Learn a Programming Language of your choice
“The most disastrous thing that you can ever learn is your first programming language.”― Alan Kay
C++, Java, and Python are some of the most popular languages for competitive programming. Python is a relatively sluggish language while being straightforward and simple to learn. In some competitions, Python is not even permitted.
First, try to learn the basics of the language you chose!
Although some fundamentals vary from language to language, you should be familiar with the following:
- Loops, If-else, Switch
- Data Types
- Keywords, Numbers, Characters
- Searching & Sorting
- Identifiers, Functions, Variables
- Array, String
- Input and Output Operations
If you choose C++, then the basics also include OOPS:
- Object & Classes
- Overloading and other basic stuff….
Step 2: Start practicing and take part in Contests
As a beginner, Start solving the Problem on coding websites like Hackerrank, chodchef. Implementation, Strings, Sorting, Searching, Greed, and Bit Manipulation are covered in order of Easy, Medium, and Hard. You will start to feel like you have learned a lot of new things if you try to obtain 6 stars on it. You'll start writing more effective code, and your code length will go down.
Participate in competitions on websites like Codechef and Codeforces in the interim because they're a terrific method to pick up fresh ideas. You might initially find the language of problems a little challenging to understand, but after a few competitions, you will become accustomed to it.
Don't forget to solve the challenges you couldn't solve in the competition.
Step 3: Learn Data Structures and Algorithms
Get your hands dirty with data structures and algorithms as you practice and compete.
The most crucial section is where you discover how to improve the effectiveness of your program. Selecting the best data structure for a task will be made easier for you if you have a solid understanding of data structures.
Step 4: Practice, Practice, and Practice…
It is the most important part of your overall CP journey!
The biggest mistake programmers make is probably getting discouraged and not practicing enough. Or practicing only on problems they feel they’re good at.
Competitive programming can only be improved by “PRACTICE, PRACTICE, AND PRACTICE”. Try to solve as many questions as you can on sites like GeeksforGeeks, HackerRank, CodeChef, etc. This will enhance your mind to think more about algorithms.’
Some Do’s and Don'ts
- Never hop onto the editorial or solution when practicing on any platform without giving it your all. It won't help you to peek into the answer. You should always do your hardest to solve a situation. Even after an hour or two, if you are still unable to find a solution, read through the editorials and conversations and make an effort to fully comprehend the Code before attempting to put it into practice on your own.
- Always attempt to up-solve the issues you were unable to answer in the contest after the event has ended. The actual learning begins here. Look at the conversations and editorials.
- Do not hesitate to look at the solution of other people/friends after the contest. Maybe your friend’s approach could be better than yours.
- Do read Blogs on Codeforces written by High Rated Coders. You will get to learn a lot from them for sure.
- Do not stick with just too easy problems. Get out of your comfort zone and challenge yourself. Start solving problems that push you.
- Make a company of friends who also enjoy CP and have a healthy competition with them. Discuss your doubts with them(Obviously not during a contest ).
- Do not worry about ratings on various Coding Platforms. Rather focus on your growth. Your rating will automatically increase if you focus on learning.
- Do not get demotivated or disheartened if you cannot perform well in a contest or cannot solve a problem. It happens. Just learn from your mistakes and try not to repeat them.
- Competitive Coding is much more about practice. It takes time to become a master in it. So never give up(unless you don’t enjoy doing it) and never have self-doubt about yourself.
Why should you start learning competitive programming?
The most sought-after ability that a selection board or interviewer looks for in a candidate is problem-solving.
Let's now look at coding-related issue solving. Competitive programming challenges programmers to write code in a programming language based solely on the issue statement, limitations, input type, and intended output, which improves their problem-solving abilities. The user's given code is evaluated for effectiveness and put through an unidentified test case test. If the program has no mistakes, it is compiled or interpreted and passes the test cases without going over the allotted memory and time limits. When the software is approved as the solution, you are given points.
Patience, dedication, and consistency are very important to becoming a good competitive programmer.
P.S: Never get demotivated, it's not a sprint, it's a marathon. one bad day does not mean you are worthless. Do it and I am sure anyone who has a knack for problem-solving will fall in love with this beautiful sport!
I hope this has brought some value to you!
Liked our content? Do kindly like and share to help other students in your network. And don't forget to subscribe to the newsletter to NEVER miss an article!