COMPETITIVE PROGRAMMING AS A SPORTS by vichitr gandas nitk

Many of us face problems in competitive coding. Although we have good programming skills, only the format doesn’t suit us. So if we tackle competitive programming as a sport, we will be feeling happier and less tired in solving these problems. We all have an equal amount of intelligence. No extra intelligence is required in this.

People enjoy playing sports like Cricket, Football, Badminton etc., but there is a community of programmers who enjoy playing with their codes. This sport is called Competitive Coding/Programming. The difference between other sports and competitive coding is that you don’t require much physical activity in competitive coding. Nowadays, coding is used in almost every field of work directly or indirectly. It’s not just the need for tech companies, but of each and every business. From accountants using spreadsheets to artist and designers using graphics software, everyone needs coding in some way. All major tech companies like Google, Facebook etc., hire top coders. Coding is one of the most demanded skills today. Competitive coding is a form of coding as a sport. Many people do it just for fun, to enjoy it, while others do it to get a good-paying job in the tech industry.

In competitive coding, participate-e breaks even some problems to solve and are requ, unite, and write its code in any acceptable programming language. The problems are generally logical or mathematical. However, participants may require the knowledge of algorithms, data structures, number theory, geometry, graph theory or any other related topic to solve the problems. Competitive coding has a huge community, including school and college students. It is all about thinking quickly to understand the problem and break down into the most optimal way possible and write the code in a programming language. In the very beginning, people get demotivated when they don’t get their solution accepted. But believe me, don’t let yourself down and keep trying; you will start feeling the pleasure of accepted solutions. Many people like me do it just for the satisfaction of getting their solution accepted. In my opinion, this is the best sport everyone should at least try.

Why should one try competitive coding? Competitive coding may not be the ultimate coding practice to write good and well-documented code, make optimum use of memory and other resources and work in an organizational environment. But if you are good at it, learning other things will be a piece of cake for you. You can easily crack standard coding interviews, and you can easily solve a programming problem or puzzle given during an interview. In the sport of competitive coding, you get the habit of solving challenging problems, and you do not give up easily. Also, competitive coding improves your debugging skills. If your code fails to get accepted, you need to think about where it went wrong. This also improves your thinking skills. While participating as a team, you also learn to think, code and debug as a team which is the most important skill required today. Although competitive coding does not involve any other aspects of programming like Networking, Cryptography, Artificial Intelligence, Machine Learning etc., it improves your knowledge of algorithms and data structures tremendously and develops your thinking, logical and analytical skills which are otherwise hard to instil. You can also win prizes like t-shirts or goodies or even cash in the contests.

The most prestigious coding contests are ACM-ICPC, Google Code Jam, Facebook Hacker Cup, TopCoder Open, Codechef SnackDown and IOI. IOI (The International Olympiad in Informatics) is an annual international competitive programming contest for secondary school students while ACM-ICPC is an annual international competitive programming contest for collegiate students. These competitions are usually held on online judges. Some popular online judges who conduct contests regularly are – Codeforces, Codechef, HackerEarth, AtCoder, TopCoder, Hackerrank. To compete in coding contests, you need good knowledge of a particul language, preferably C++/Java/Python. C++ is the choice of most competitive programmers as it is fast and has a nice STL tool. I will describe some of the platforms mentioned above.

Codeforces:

cp_codeforces.png

This is the best available competitive coding platform today. It conducts 2-3 contests every week. It is known for regular contests. All code forces contests contain outstanding problems. Mostly all contests are balanced on Codeforces. It also conducts Codeforces Educational Rounds. The goal of such rounds is to practice and educate rather than to compete.

Codechef:

cp_codechef.png

Codechef is also a good platform to learn and compete in competitive coding. It conducts three contests each month – Long challenge, Lunchtime, Cook-off. Long challenge is meant to learn a lot of new concepts as it’s a 10-day long contest. Codechef problems mostly require very much thinking and debugging. It would be best if you kept trying.

HackerEarth:

cp_hackerearth.png

HackerEarth also conducts three contests every month – Easy, HourStorm and Circuits. HackerEarth problems are damn good if you want to learn. But most of the times, problem statements are not clear. Circuits is an 8-day long contest so you can learn and try.

Hackerrank:

cp_hackerrank.png

If you want to start coding then this is best platform to start with. Hackerrank problems are usually easy and simple. It conducts HourRank every month. And two other contests – Week of Code, Codesprint are held over a period of 2 to 3 months.

AtCoder:

cp_atcoder.png

This is a famous Japanese judge. AtCoder problems are usually mathematical. It conducts three contests – ABC(AtCoder Beginner Contest), ARC(AtCoder Regular Contest) and AGC(AtCoder Grand Contest). AGC is held once a month. ABC and ARC are held 2-3 times every month.

TopCoder:

cp_topcoder.jpg

Topcoder is not a cup of tea for everyone. As its design is very confusing, participants must atat dot doClass and Method to solve amanytead of the whole code. But its problems are outstanding. Most topcoder problems are DP (Dynamic Programming) problems, so if you want to master DP, try to topcoder. It conducts 2-3 SRMs every month.

Except for these, CS Academy is also a good platform to compete. It conducts 1 contest per month hardly. But academy problem statements are concise and clear without any story. Other than these, some platforms which does not conduct contests but have a lot of good problems to try and learn are – SPOJ, UVa Judge.

SPOJ: It’s a problem Archive (recommended for all beginners). Start with problems having maximum submissions. Solve the first few problems (may be 20). Build some confidence. Then start solving problems topic wise. Never get stuck for too long in the initial period. Google out your doubts and try to sort them out, or you can discuss with someone (only in the beginning).

These are some topics to start with –

  • Arrays, Strings
  • Basic math operations (addition, subtraction, multiplication, division, exponentiation)
  • Bitwise operations
  • Searching (Linear and Binary) and Sorting
  • Basic Recursion
  • Euclid’s GCD algorithm
  • Sqrt(n) primality testing
  • Greedy algorithms
  • Basic data structures – Stack, Queue
  • Prime Numbers, divisibility of numbers, factorization of a number

Some advanced topics are –

  • Sieve of Eratosthenes
  • Modular Arithmetic – division, inverse
  • Divide and Conquer
  • Dynamic Programming
  • Heaps
  • Segment Tree
  • Binary Indexed Tree
  • Disjoint Set Union
  • Suffix Arrays
  • Trie
  • Tree traversal
  • Lowest Common Ancestor (LCA)
  • DFS, BFS
  • Shortest path algorithms – Dijkstra, Bellman-Ford, Floyd-Warshall
  • Minimum Spanning Tree – Prim’s and Kruskal’s algorithms
  • Biconnectivity in undirected graphs – articulation points and bridges
  • Strongly connected components in directed graphs
  • Topological sorting
  • Euler path/tour/cycle

Once you have a good catch and confidence, dive into the world of competitive coding and start participating in regular contests on Codechef, Codeforces etc.