What is Competitive Coding and How to be a Competitive Coder?

·

5 min read

Coding... Competitive Coding…

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 be a competitive coder?

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, I 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(Highly recommended are C++/Java)
  • Time and Space Complexity Algorithms
  • Ability to think about a Brute Force Solution
  • Good grip over data structures like Arrays, Linked Lists, HashMaps, Trees, Graphs, Heaps, Tries etc.

1. Choose a Programming Language

Firstly, you need to learn a programming language if you don't know any. The most recommended language is C++ or Java.

Python doesn't even count when it comes to competitive programming because of its huge set of libraries(basically it hampers your logic building growth).

2. Understand the Concept of Space and Time Complexity

In most of the cases there is more than one solution to a problem. You need to come up with one of the bests solution i.e. optimal and optimalism of a solution is decided by the amount of space and time it takes to run it.

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 Leap and Participate in Contests

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 Leetcode, InterviewBit, GeeksforGeeks, Hackerrank, Codeforces, Codechef, Topcoder, SPOJ.

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.
  • 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. Build a Habit of doing it Regularly

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.

Did you find this article valuable?

Support Dev Mehta by becoming a sponsor. Any amount is appreciated!