Friday, 27 March 2020

How to start with Competitive Programming?

So you want to start with Competitive Programming? Good, you’re at the right place :)

The following are the steps to help you get started.

Pick a language

Language is the most crucial thing for communicating ideas. An ideal language should be the one that can help you pass the time and space constraints. Python may not be the ideal solution here. Sure it involves a lot of built-in functions but one cannot deny it increases your time of execution putting an impact on CPU memory since it uses an interpreter for line by line execution.

So what to choose? As you can see below is a clear comparison between codes written in .py and .cpp. Surely it depends on the programmer’s ability to shorten code but not too much to create such a big difference. 




2 of the best programming languages known for competitive programming are C and C++. We would recommend C++ here. Both of them take less time of execution than Python but one cannot deny how C++ STL makes your life easier.

Start with Basic Problems

Start your journey by solving basic problems like how to find a prime number, the number of factors of a number, factorial of a number, find greatest/lowest among array, insert an integer into an array, string operations using ASCII values, the sum of the digits of a number, etc. You can find a bunch of such problems on SPOJ.

You might not realize the worth of solving these problems but practicing these more frequently could help you shorten the code than earlier which you used to right and help you save time. Additionally, you will learn how to write error-free code.

Learn Data Structures and Algorithms

Data Structures and Algorithms are going to be your biggest friends if you choose to make them! Not only in your Competitive Programming journey but also in your Placement Interviews.

And it’s super fun to learn them. Once you dive into it, you’ll enjoy the essence. You’ll be amazed at the scope of DSA usage from Google’s fastest search to quickest commute in Uber, DSA plays a role everywhere!

Hey, wait! Are you practicing?

Tried HackerRank? CodeChef? HackerEarth? Practice is highly important to understand the types of problems. Also, practice improves your question reading skills which can help you save time. Mathematics is super fun and you’ll be amazed to know how mathematical functions can be used to find solutions to such complex scenario problems.

As you finish the warm-up problems move on to implementations, strings, sorting, search, recursions, debugging and several other sections that’ll help you master the art of solving problems. 

The best part about these platforms is they not only help you prepare but also enhances the spirit of competition, the spirit of winning. One just cannot express the feeling of satisfaction when you get solving problems. The feeling which you get achieving the Gold badge is amazing! Nobody can take it from you, it’s yours!

Why not involve your friends?

In today’s era, nobody can complain of being not aware of current technology trends. If you’re ignoring this, you’re missing out on a lot my friend!

Practice Competitive with a group of friends or a community. Most colleges now have IEEE, CodeChef Chapters in their universities which are non-profit organizations that help increase technical awareness among young students. Even though these opportunities are present in almost all colleges people usually prefer to procrastinate on this. Some students often tell - “I’ll join them next semester” or “I think maybe I can do it much better sitting in my hostel room” and later you find these guys watching Naruto in their hostel rooms. Make sure it’s not you!

Are we practicing?

Practice must never stop! Practice! Practice! Practice!

Even if you don’t get time, make it to just 5 - 7 problems a day. Learn about more algorithms like Greedy, Dynamic Programming, Backtracking, etc. And don’t forget to revise Data Structures and Algorithms regularly.

Competitions Define Us

Take it a positive way. Competitions. Yes, they do help us know where we stand. Even while you began practicing Problem Solving on HackerRank there would have already been over a million people and you’ve practiced daily to get to your favorite badge. True?

The same is with Competitions. Don’t get stressed. You may not want to directly target ICPC. But you can at least get started involved with regular challenges on platforms like CodeChef. There are many competitions that take place in colleges too, keep your eyes open to all. Don’t miss out on any opportunity.

Dedication

Yes, dedication is important because you’re investing a large part of your time here! You have to get serious about your Competitive routine. You have to constantly analyze the problems which you couldn’t solve earlier or the ones which were taking a long time. Don’t get disheartened if you’re not getting a solution. Look out for help. Again solve until you become perfect. Soon you’ll realize it doesn’t take long enough to get to a Star Ranking on CodeChef. 

Wait! Don’t get complacent! Solve tougher problems. Remember during Engineering Exam preparation, some of us used to solve I.E Irodov problems in Physics. Why? Simple because we could differentiate ourselves from others and hence adopt the same here!

There are a lot of prestigious competitions and tournaments like ACM ICPC, Google’s Kickstart, HashCode, etc. Many of them are sponsored by big tech giants and there are absolutely big prizes!

Additional Readings
All the best!

Contributed by: Dhairya Ostwal

3 comments:

  1. Aman bhaiya
    Your other blog for jee aspirants in which revision corner is not opening
    I tried it from multiple devices. It is saying site cannot be reached pls
    Help

    ReplyDelete
  2. Hi Aman,

    I've just started learning python basics.

    Can you please suggest good sources to practice problems, boty beginner as well as intermediate?

    Thanks in advance

    ReplyDelete
  3. A blog on debugging and corner case detection will be helpful Aman.

    ReplyDelete

How to start with Competitive Programming?

So you want to start with Competitive Programming? Good, you’re at the right place :) The following are the steps to help you get start...