Efficient learning in Competitive Programming

Many competitive programmers (myself included) often face difficult problems that we cannot solve for days on end. This is normal because no one knows everything. But I feel that spending many hours trying to crack a single problem is a waste of time and stems learning. If we cannot solve a particular problem, it could probably be due to the lack of one or more specific skills and/or concepts. For example, how would a beginner programmer know how to use dynamic programming? He or she would not even know that the question requires dynamic programming. As a former beginner, I can emphatize with those sentiments.

When I first embarked on my Competitive Programming journey, I could spend an entire day working on a single problem, which turned out to be very trivial after using a few simple tricks. As such, it is imperative to read editorials and other AC (accepted) solutions rather than trying to "challenge ourselves". Learning from others will help prevent us from reinventing the wheel. For example, we could use dijkstra's algorithm to solve certain shortest-path problems rather than inventing our own. The beauty of Competitive Programming is, it studies well-known problems (and their variants). This means that all these problems already have a known solution - we don't have to tackle research problems such as proving P=NP. Since solutions are already available, why not use them? This suggests that choosing an online Competitive Programming platform with good editorials is important for our learning.

In my opinion, AtCoder is a site with excellent problems and edtorials. Its editorials are well-prepared and well-written. What do I mean by well-written? It means that the editorials come with formal proof of the solutions (not the proof by obviousness as many authors on CodeChef/HackerRank have been using). Codeforces is another excellent resource. However, its editorial authors are sometimes guilty of proving by obviousness. On the other hand, assuming that good editorials are available, they may still be unable to help us understand the solution in its entirety. This could be due to the fact that the reader lacks the required background knowledge that is assumed by the editorial. Another cause could be, the author's approach just does not seem intuitive enough to the reader. Hence, while the availability of good editorials are important, they are only able to provide limited help to the programmer.

Since editorials do not provide sufficient help, I have devised several ways to aid my learning. Namely, read other people's solutions, ask for help on forums, acquire more knowledge and solve simpler problems. From my experience, the second strategy is not so reliable as not everyone is willing to share their knowledge. Reading other people's solutions, especially those of high-rated coders, will more often than not, teach us a trick or two. Personally, I learnt a lot just by using this strategy. Acquiring more knowledge is a point that should never be neglected. As I mentioned at the beginning of my post, inability to solve a problem could mean an inadequacy in our knowledge. Furthermore, one algorithm may be better for a particular problem as compared to another. One example would be using MO's algorithm, which is much simpler and easier to code, to solve the RMQ problem rather than a Segment Tree. Last but not least, moving on to solve simpler problems could potentially save a lot of time. Perhaps we might learn some tricks from solving other problems that would eventually enable us to solve the difficult problem! These 4 strategies, have helped me to save countless hours and solve many more problems.

Different practitioners may have different strategies and approaches to tackle this learning bottleneck problem. Of course, there is always room for improvement. Hopefully, my strategy could help me to become a red (expert) coder eventually.

Comments

  1. Im in a position where I cant solve any of the Beginner USACO problems from the training website. Am i incompetant or is it that i lack the problem solving skills to even apporach the problem? What should I do so I can solve the easier USACO problems.

    ReplyDelete
    Replies
    1. Hi there.

      If you are a beginner, you probably aren't familiar with the common tricks that are used in Competitive Programming problems (e.g. prefix sums, flattening a tree, etc). Once you become familiar with them, you would find that you can solve most (if not all) beginner problems with great ease.

      Cheers,
      Lance

      Delete

Post a Comment

Popular posts from this blog

USACO - Broken Necklace

HackerRank - Search in a 2-D grid