If you’re wondering how to be an ace programmer, then one of the best ways to do so is through competitive programming. Topcoder, Hackerearth, SPOJ, etc all must ring a bell, these are sites that provide high-quality problems to you that are a little difficult to crack. Competitive programming needs a slightly different approach than regular programming.
How is competitive programming different from normal programming?
I got this excerpt from a popular Quora answer which could answer it best:
This basically tells us that in developmental programming, we need to write an efficient code. However, competitive programming requires a code which “just works” with the given conditions.
So, what exactly do you need to “kill the lion” in 2 minutes?
- You need to know the basics of a language, pick any, C++ or Java, whichever you’re comfortable with.
- Pick an online judge. Some popular ones are: topcoder, SPOJ, codechef and hackerearth.
- Start with simple problems such as Div 2, 250
- Practice these problems thoroughly such that you earn around 240 points a day.
Sounds easy? Well, for those of you who have tried a hand at it must know that TERMS like TLE(Time limit exceed), MLE(memory level exceed) and WA(Wrong answer) are so good at giving NIGHTMARES!
How to be a Ninja Competitive programmer?
To gain crazy ninja skills at competitive programming, one needs to have a grasp of a few specific topics.
Topics mostly covered in contests are:
- Graph algorithms: Breadth first search (BFS), Depth first search(DFS), Strongly connected components (SCC), Dijkstra, Floyd-Warshall, Minimum spanning tree(MST), and Topological sort.
- Dynamic programming: Standard dynamic programming problems such as Rod Cutting, Knapsack, Matrix chain multiplication, etc
- Number theory: Modular arithmetic, Fermat’s theorem, Chinese remainder theorem(CRT), Euclidean method for GCD, Logarithmic Exponentiation, Sieve of Eratosthenes, and Euler’s totient function
- Greedy: Standard problems such as Activity selection
- Search techniques: Binary search, Ternary search, and Meet in the middle
- Data structures (Advanced): Trie, Segment trees, Fenwick tree or Binary indexed tree(BIT)
- Game theory: Basic principles of Nim game, Grundy numbers, and Sprague-Grundy theorem
Our newest online course Eminence indulges in all of these so-called tricky topics just so that can ace that programming contest in just three months. Eminence will be taken up by Ankush Singla who has a Bachelor’s degree in CS from IIT Delhi and Masters in Computer Science from Stanford University; and Parikh Jain, the “ninja” of competitive coding who holds a degree in CS from Delhi Technological University (DTU). Register now to book yourself a seat in a course that will brush up your competitive skills to a whole new level.