Competitive programming is a mind sport and you have to practice to master it. Let’s take the example of cricket to understand it better. When you enter the field to bat for the first time, you do miss a couple of balls before hitting one over the rope. The same is the case with competitive coding.
Initially, you may submit your code and get a wrong answer. You try again and eventually you get your first accepted or correct answer. Around 20 % of the questions in competitive coding are nothing but the simple conversion of plain English to a code of your favourite programming language.
Without any further ado, let us have a glimpse of some of the secrets to excel in Dynamic Programming and winning at Competitive coding.
Navigating through algorithms and data structures
Try to follow the hierarchical approach. You cannot start running without knowing how to walk! Therefore, you must begin your journey with the fundamental algorithms and data structures. If you deeply understand the logic behind basic algorithms, the high-level algorithms will seem easy to understand. This approach will rapidly leverage your knowledge.
For the dynamic programming questions, try to think globally optimal and not just locally. Break the problem into smaller and simpler sub-problems and solve each one of them. You will end up building your solution by combining these solved sub-problems.
The favourite topic among the problem setters is trees and graphs. It is clearly evident from the omnipresence of problems on Trees or Graphs in long and hiring contests. What to do now? Well, if you want to land into your dream job through a hiring contest, you must brush up on your trees and graphs concepts!
Some of the most important concepts are Kruskal and Prim algorithms, AVL trees, tries, topological sort, traversals on all kinds of trees and searches in graphs.
Practice makes you perfect
Try to participate in as many competitions as you can! To begin with, you can choose the problems with the maximum number of submissions. Solve a few problems to boost your confidence.
In the initial phase, do not invest much time solving a single puzzle. Research about your doubts or take help from someone (but only in the beginning). Gradually increase the number and difficulty level of the competitions you are participating in.
There are many online platforms that host online coding competitions. One such coding event is Code Kaze, hosted by Coding Ninjas. This online coding competition will benefit a wide range of coding enthusiasts. The competition will foresee participation of 50,000 students from India’s Premier Tech Institutions like IIT Bombay, IIIT Delhi and Allahabad, NIT Trichy, Panjab Technical University, VITs and many more.
Don’t let that ship sail
Most of the coders rush in attempting the question before planning or writing logic to crack the problem. Due to this, they end up getting stuck on that problem. Cracking the logic before starting the code will help you save time.
Read the questions at least two times, before you attempt the answer. Analyse the problem and keep the input-output pattern in mind before the submission. Understand the instructions carefully such as the time limit, meaning of symbols on the contest page, number of permitted submissions, etc. Keep an eye on the clock and if you are not able to solve a question, move on to the next one without wasting time.
In case your program is not accepted, analyse the code again and check about the variable declaration, the complexity of the code and the numbers of test cases.
So, we are saying….
Stay motivated throughout the process of competitive programming. Building a team and solving problems is a good way of staying motivated. Not giving up is the reason behind the success of all the top programmers and coders.