If you haven’t read the first two parts of this series, you can read them here:
This part will lead you with the next step in your programming journey. This is the part where you actually start practicing problem-solving, competitive programming style.
The following is the way I have found to be the most effective.
1. SPOJ and PROJECT EULER
The first step in your competitive programming practice, for it to be the most effective, choose these two websites. SPOJ is the best and the leading forerunner in terms of programming contest style questions. Their online judge is awesome. SPOJ engine is also used by CodeChef.
The way to practice problems is this.
You have to sort the problems in descending order of number of users who solved a problem.
If it helps, here is the link for that – SPOJ Classical Problems – Sorted – bookmark it.
Also, go and check out ProjectEuler. Create an account there, go to the problems page (renamed archives, currently).
The problems are arranged by default in the order of increasing difficulty. So I don’t think you will have a problem there.
Once you have done the account creation and you have checked out what are all present there, you can then get to work.
First of all, solve problems side by side – concurrently in these two websites. In the case of SPOJ, you have to submit your code and the engine will accept your code if everything checks out and your code passes all the test cases for the particular problem you have chosen to submit the solution for. The more you solve, the more the number of points you receive.
Solve the first 300-400 problems in that link I gave for you to bookmark. In the process of solving those first 300-400 problems, you will learn the most important concepts of data structures, algorithms, time and space complexity, bit manipulation, playing with numbers, and logical thinking. You will have to learn these things if you are gonna solve the problems, come up with a solution and write a code that will be accepted by the judge.
Concurrently, when you start solving ProjectEuler problems, you will find that the problems they have given cannot be solved manually. Those problems can only be solved using programming. More so, they can be solved only with efficient programming with a scalable solution. These problems that you solve in ProjectEuler will give you a lot of essential mathematical knowledge – more specifically, you will learn a lot on concrete mathematics.
ProjectEuler wise, there is no limit to how much you should solve. You can work towards solving every problem given there. But, solving the first 100 to 150 problems would give you a great amount of familiarity with the core concepts of math used in solving programming contest style problems.
2. Beginning Practice Through Contests
The next step for you will be heading to. Once you have gone through the first step, you will be ready to participate in contests. You will be able to solve the contest problems, but the speed, accuracy, scalability factors won’t be present much when you begin participating in contests. This is why you should start participating in contests as soon as you complete that first step I mentioned above with respect to SPOJ and ProjectEuler.
Codeforces will be a great place to start. They host Single Round Matches every week. The prizes may not be much, but participating in them will give you an incredible amount of real-time practice, and you will also start seeing an improvement in how quick you can come up with the solution, how quick you can code, how much you can scale the solution, etc,.
3. Codeforces & Hackerrank
So, even as you participate in Codeforces SRMs, start solving the problems in the Codeforces gym. Those problems are all the ones given in the past contests. Solving them will give you a good idea of how the future contests and their problems will be like. Start with the most recent and go backward in time, with respect to the contest gym problems that you solve.
Hackerrank wise, the site has sorted the problems into different categories and they are all amazing. The user interface and navigability is awesome! The online judge of Hackerrank is nothing short of awesomeness. You get proper feedback. Unlike SPOJ, Hackerrank has a very active and very easily usable community forum kind of thing where you can ask your questions, get them answered. Hackerrank, formerly called InterviewStreet, is the leading online judge that most of the tech companies use when conducting their preliminary round of machine coding for their interview process. So, practice stint with Hackerrank will come back to help you one way or the other.
4. Other things that you should do
If you follow through with the first three steps mentioned here, you will find that you are ready for contesting in contests. You will also find that you are slowly improving with respect to your SRMs in Codeforces.
It is at this stage, you will find some books and resources very useful.
BOOKS that you will find very useful:
This book is one of the most recommended books for your competitive programming journey. You will learn so much from this book than you have ever learnt from any other algorithm related book. This book will teach you one skill that you really need to have in your programming contest skillset – SCALING. Scaling your solutions for a huge amount of data input no matter what problem you are solving, is the most coveted skill in the competitive programming area.
This is the most suggested math related book for competitive programmers. As a competitive coder, you need to be very strong in algebra, discrete maths, and few other math topics. This book will teach you all that you need to know in your journey of competitive programming.
Resources that you will find very useful:
The following resources are the ones I found to be the most helpful in providing you extra knowledge.
5. The Final arena of Practice – Topcoder
No matter what anyone has to say, of all the online judges, Topcoder is the best and the most popular platform for all the competitive programmers. Practicing in topcoder with their SRMs will give you a competition experience in the real sense, because you get awarded with points for solving those problems with the time you take to solve the problem and submit the code taken into account for calculating those points.
Also, Topcoder has a rich set of dynamic programming problems. Start with div-II-250 SRMs and go up to div-I-500. But practicing in Topcoder is surely bound to give you a lot of improvements in speed, accuracy, critical thinking when compared to practicing in any other site.
How should you go about it?
First go through this – Topcoder Algorithm Tutorials. This will get you up to speed with respect to familiarizing yourself with Topcoder style problems and how to go about solving them.
Once you have done that, start solving problems in the arena. You can start with Div-II-250s. Go through Div-II-500 problems too. If you think you can solve them, try them too. Then slowly move up to div-I problems. Start solving more dynamic programming problems, and you will find yourself getting more and more experienced and gaining the required expertise to become one among the greats in competitive programming.
Some resources that you will find very useful with respect to Topcoder:
NOTE TO THE READER:
If you have any suggestions, and any improvements that you think I could do to this article, please do let me know in the comments section below. I will make sure I’ll include your input in this post. I want this series to be helpful to as many people as possible and I have written it in a way that seemed the best fit. If you think that this can be improved, probably some more resources and some more steps can be added to the guidance – I’d be happy to take your inputs and include them where they fit in.
Also, you can check out the Final Part of the series.