How to get good at competitive programming

Programming with Shahan - Dec 13 '23 - - Dev Community

Are you READY to excel in competitive programming and shine in coding interviews, like those at Google, but not sure where to start?

This blog post will guide you through the PROCESS and help you avoid common beginner mistakes.

Image of competitive programming

Starting with the Basics

1. Language Proficiency

Before jumping into programming, ensure you're comfortable with English, as most online resources use this language.

2. Math Skills

Contrary to what you might think, MATH is crucial in computer science (CS). You'll need a good grasp of ALGEBRA and COMBINATORICS, equivalent to the US grades 8-10 level.

Don’t worry about geometry, trigonometry, or calculus for now.

Basic modular arithmetic and number theory are also important. If you've participated in math contests like MathCounts or AMC, you're already ahead!

If you need to brush up on these topics, HackerRank’s math section offers excellent practice problems in number theory, combinatorics, algebra, and probability.

3. Touch Typing

Boost your typing speed by mastering TOUCH TYPING, where you type without looking at your keyboard. Websites like keybr.com can help you improve. Aiming for 50-60 words per minute is a GOOD start.

Learning a Programming Language

1. Choice of Language

Many top competitive programmers use C++. It's fast and ideal for solving complex problems.

However, if you already know a language, stick with it until you reach a HIGHER LEVEL. For example, Java can take you far too.

If you’re a complete beginner, starting with C++ is a good idea. Check out online tutorials for the basics.

2. Practice

Once you're comfortable with the basics, practice on platforms like HackerRank to SOLIDIFY your understanding.

Diving into Competitive Programming

1. Problem-Solving, Algorithms, and Data Structures

Now it's time to focus on the CORE of competitive programming.

Resources like the Competitive Programmer's Handbook and GeeksForGeeks’ algorithms page are GREAT. Google can also help you find articles on specific topics.

2. Practice Platforms

HackerRank is great for PRACTICE, especially its algorithms section. A2OJ ladders and Mostafa Saad’s spreadsheet offer well-structured problem lists for ALL LEVELS.

3. Contests for Beginners

Start with beginner-friendly contests like LeetCode weekly contests, AtCoder beginner contests, and Codeforces division three rounds.

Common Mistakes to Avoid

  1. Relying Solely on College Courses: College courses are more geared towards CS research, not competitive programming.
  2. Reading Too Much: CP is about active problem-solving, not passive reading. Spend less time reading and more time PRACTICING.
  3. Learning Advanced Techniques Prematurely: Master the basics before moving on to complex data structures and algorithms.
  4. Comparing Yourself to Others: Everyone progresses at their own pace. Focus on your journey, not others’.

Final Thoughts

Competitive programming is a marathon. Improvement takes time and CONSISTENT practice.

Remember, this is your journey, so focus on your GROWTH and enjoy the learning process!

Note: This post was originally derived from William Lin's YouTube channel.


Stay tuned and visit my YouTube channel for more tips on programming.

Thanks for tuning in, and don't forget to share your thoughts in the comment section below!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .