7 Essential Tips for Competitive Programming and DSA by@clumsycoder
2,068 reads

7 Essential Tips for Competitive Programming and DSA

tldt arrow
Read on Terminal Reader

Too Long; Didn't Read

Data Structures and Algorithms and 'Competitive Programming' are inter-related but quite opposite things. DSA is all about solving real-world problems mainly using programming concepts that are vaguely related to computer science. CP is a mind sport to train your brain, get better at problem-solving and critical thinking; you should try competitive programming. The best word I have come across to describe CP is'mind sport'. You compete with other coders to solve a problem using your programming, logic, and analytics skills in a minimal amount of time and memory.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - 7 Essential Tips for Competitive Programming and DSA
Kaushal Joshi HackerNoon profile picture

@clumsycoder

Kaushal Joshi

SWE Intern @ Hackernoon | MERN Stack Developer | Technical...

Learn More
LEARN MORE ABOUT @CLUMSYCODER'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

As like most CS undergrad students in India, I decided to start competitive programming to level up my coding skills. It was August 2021 and I thought I can easily get comfortable in a year - so it will help me in my college placements. But things got chaotic and I started questioning my entire software development experience and four years of college life. I became so stressed that I quit doing CP and lost confidence to build basic websites.

It's been four months now and I have enough confidence to start everything once again. In my fallback, I tried to analyse what went wrong and what steps should I have taken to not make it worse.

There were plenty of things that I did wrong. I started without knowing anything about CP or DSA. I just jumped in the river thinking how cool I would look while diving deep into the water without guessing the depth of the water.

Here are a few things that I want to share from my experience of one month of doing CP and DSA:

1. 🧮 Understand the difference

The first mistake that I made was that I treated both things equally - in the wrong way! 'Data Structures and Algorithms' or DSA and 'Competitive Programming' or infamously known as CP are inter-related but quite opposite things.

DSA is all about solving real-world problems mainly using programming concepts that are vaguely related to computer science. You are supposed to find the solution that is most suitable for real-world scenarios. Later you need to implement it using code.

The best word I have come across to describe CP is 'mind sport'. You compete with other coders to solve a problem using your programming, logic, and analytics skills in a minimal amount of time and memory.

It is said that DSA helps to solve real-world problems that you might face in your actual job. Focusing too much on CP would surely help you land a good job but the later path would be difficult. You can achieve similar things with both but sticking on one path would help you to achieve it sooner. In either case, your problem-solving skills will play an important role.

2. 🎯 Set your goal

Ask yourself, what is your final goal behind this. Do you want to ace programming interviews, increase your development skills, want a mind sport to train your brain, get better at problem-solving and critical thinking, or anything else?

Based on your goal, you can focus on a few important things rather than trying everything out and getting nothing sufficient in return.

If you are preparing for interviews, you want to focus more on development and problem-solving skills. You don't need to keep up with each and every online coding competition. Solving problems on LeetCode, GeeksForGeeks, and HackerRank would be enough. Your main focus must be on logic building and Data Structures and Algorithms.

But if your goal is to train your brain like a pro coder and get better at problem-solving and critical thinking; you should try competitive programming. The main trick is to use every aspect of programming that you know to solve the problem in the most efficient way possible.

Doing competitive programming would automatically prepare you for interview rounds since you are working on your DSA skills at the same time. However, it's hard to say the other way around.

3. 📑 Start gathering information

Once you have decided what to do - DSA or CP, give yourself two days and collect everything that you find useful. Books, roadmaps, YouTube playlists, websites, portals, influencers, everything you can. I am saying this because I found some useful stuff AFTER I quit. So having some base in your hand before you start will give you an idea of what you will do next. One important thing that you should do is talk to people who have been doing it and have a better experience. Ask for help, they can guide you better than most of the things I mentioned in the last paragraph.

💡 Pro Tip

Do not blindly follow anyone, especially YouTubers and influencers. Just take the informative part that they have to offer and completely ignore everything else.

4. ✅ Clear your fundamentals

Okay, so now your prerequisites are completed. It's time to jump to the main part. I believe that this is the second-worst mistake that I made Which overwhelmed me and I got exhausted too early. I didn't clear my fundamentals and directly started with CP thinking I would catch up on anything that I might have missed as I go. AND I WAS WRONG!

Starting without clearing your fundamentals won't look like a problem at first but it'll slowly affect your performance as you move on to the intermediate stuff. Make sure you are familiar with following this before you start solving problems:

Language

The language choice won't make a lot of difference if you ask me but it is always better if you are doing it with C++, Java or Python. During most of the interviews, at least in India, you're not allowed to use languages other than C, C++, Java and Python. And since time plays an important role in CP, choosing a faster language (Like C++!) is always beneficial.

Programming fundamentals

If you're reading this, there is a high chance that your programming fundamentals are already clear. But don't forget to brush up on your learnings before you start. You can use the following list as a checklist:

  • Data types
  • Functions / methods / classes
  • Type conversions
  • Decision Making
  • File I/O
  • Bits / strings / arrays manipulation
  • Time and space complexities

Language fundamentals

Every language has something unique to offer, learn it. There might be efficient ways to implement logic that you were unaware of. This would help to improve your understanding of the language which will help you to solve problems quicker.

If you have chosen Java, using the collection framework will save a lot of time, redundancy, and lines of your code. Similarly, using the STL library in C++ would make your code more time-efficient.

Maths

You do not only need to know these concepts on the surface but also be able to solve questions that are related to concepts using code. Start with the following concepts and you'll learn other concepts as you go to the next levels.

  • Number theory

  • Bitwise operating

  • Modulo arithmetic

  • LCM / HCF

  • Square roots / Factors

  • Fibonacci numbers

  • Prime numbers

  • Logs (To understand complexities)

5. 🧸 Start with baby steps

Rome was not built in a day!

Start slowly. Take one step at a time. Take enough time to understand the problem and solve it wisely. You will fail at the beginning. You will get stuck. You might spend an entire day on a single problem. You might get demotivated, exhausted, and overburdened. But it is just a start and you will eventually get better if you keep practicing!

Trust the process and do not quit - unlike I did 😃

If you feel stuck, figure out what exactly is bothering you and spend some time getting to know it better. Take small breaks and try to solve again.

6. ✍️ Document your progress

Whatever you learn, make notes from what you have learnt. I recommend creating a spreadsheet that has information about the problem that you solved. This would help you later to find similar patterns and better approaches while solving new problems.

7. 🤞 Don't beat yourself up

This might be ironic because it's coming from me, I know. Take breaks once in a while. Do some other stuff that doesn't include programming. I was so exhausted on the third week that I too rest for the rest of the week.


📝 Summing Up

I have summarized everything on my Twitter, you can see it here.

External Resources

If you want to start DSA, get yourself comfortable with these websites:

This is a wonderful playlist that I will follow in my journey: .

If you are planning for CP, check these sites:

🎉 Conclusion

I directly jumped on DSA and CP and got a wonderful reward for it. After researching it for about four months, I believe I have enough knowledge as well as the confidence to start DSA once again. As mentioned in the last few points, I am planning to document the learning - at least the fundamentals and share it on my blogs and socials.

If you have any experience in the field of DSA or problem solving, I would really love to hear your experience and have your guidance. I am active on Twitter and LinkedIn if you want to say hi! You can also subscribe to my newsletter to stay updated with future blogs.

Happy Problem Solving! 🥵🥇

Also published on: https://clumsycoder.hashnode.dev/i-started-dsa-and-cp-and-fell-right-hard-to-the-ground

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa