Entering the world of competitive programming can be an exciting moment. The possibility of being awarded for a skill you have honed in on for years is incredibly intriguing, but at the same time, it is the beginning of your competitive programming career, and as always, there are a couple novice mistakes to be made.
Competitive programming is quite different from typical programming and beginners hardly ever start out with the right mindset and coding style. Although there are some tricks and skills that can really only be learned the hard way, familiarizing yourself with the manner in which to code during programming contests will always be beneficial, providing a leg up over competition.
Step 1: Familiarize yourself with the writing style of your chosen contest.
Whether you are competing in American Computer Science League (ACSL) or USA Computing Olympiad (USACO), each contest has its own writing style. Preparing for your coding competition with materials from previous years will be infinitely more beneficial than preparing with materials you found online. By gaining a sense of the competition’s writing style you can figure out what topics are most likely to be assessed, and thus, which topics to spend the most time and energy preparing for.
Step 2: Brush up on common algorithms and other motifs that relate to your contest’s topics.
This step would vary from competition to competition since each contains a unique set of topics, but the gist is the same: work on the basics as much as possible. For example, if one topic in said competition is shortest path algorithms, brush up on some common algorithms. This not only provides you a deeper understanding of the contest’s topics, but also what roles they play and how they can be modified. Many competitions tend to take commonly known algorithms and alter them ever-so-slightly. By being able to identify these small changes, your chances at succeeding at contests goes up astronomically. Furthermore, this saves you time in the planning and writing phase of your contest. If you can identify and understand an algorithm, simply adding it into your program saves a lot of time compared to planning it out. In other words, reviewing topics prevents you from reinventing the wheel.
Step 3: Come up with a game plan.
Drafting up a quick plan at the beginning of your coding competition provides structure and assurance. By allocating your time efficiently, you prevent yourself from going on tangents and focussing all your time and energy on one aspect of the competition. Especially in contests with multiple programming programs, it is easy to focus your attention on one particular program and ignore the others without even realising. Furthermore, a schedule offers assurance and a sense of security - the extra boost of confidence everyone wants to start a competition with.
Step 4: ALWAYS write out your plan.
This is the most important step, and yet ironically, not writing pseudocode (the basic gist of what a program will do) is the most common mistake novices make. The mere procedure of writing pseudocode forces you to challenge what you have planned. It forces you to assign data types, plan methods, and work out details that you did not think of before. In other words, it prevents mistakes before you make them.
Step 5: Pay attention to the details.
Competitions are often particular about formatting and details because the programs they use to grade submissions can be highly particular. Therefore, it is best to pay attention to the directions and details that the competition provides. Afterall, nothing sucks more than having a program that works but gets graded incorrectly.
Once you are done with a competition, give yourself a pat on the back, you did well! After preparing and trying your best there is not much you can do, so take a break and relax - you deserve it. Good luck on your next contest!
Does this sound intriguing to you? If so, consider taking a Codefy course! Codefy hosts free courses on a variety of computer-science topics. More information can be found under the courses tab of this website, so please take a minute and sign up!
The most difficult part of a good programming project is coming up with a good idea in the first place. Why? Because millions of people know how to code and some of them are very good at it, and there are countless ways to efficiently learn how to code but any tips for coming up with ideas are inevitably vague.