DSA vs CP
Ganesh Manchi
Full Stack @TCS ? | Ex-SDE @ZopSmart ?? ( Go | Java | React ) ??♂? | 1900+ Knight @Leetcode ?? | Open Source @ Layer5 ?? | CS Engineer ??
Hello World!
One of the most confusing topics that often crosses our minds is the choice between Data Structures and Algorithms (DSA) or Competitive Programming (CP). To understand the difference, let's use an analogy: if a coding question is like a cup of tea, then DSA is the sugar. You can approach and solve problems in different ways, but with DSA, you can tackle most problems optimally.
Now, the question arises: should you practice DSA or CP?
As mentioned earlier, DSA and CP are closely intertwined. If you are genuinely passionate about mathematics and problem-solving, you probably wouldn't be reading this article; you'd be engrossed in solving Codeforces or Codechef contests. However, many of us practice coding for a job, either for financial reasons or because of the work culture.
In interviews, it's rare to encounter extremely difficult questions. More often than not, you'll face medium-level questions, with a focus on the data structures you employ and their time complexity. Interviewers are interested in your problem-solving approach, starting from a brute-force solution and progressing towards an optimal one. Your communication skills matter, and perhaps most importantly, the quality of your code (naming a variable "x" doesn't make much sense).
So, consider dedicating your time to platforms like LeetCode. If you can confidently solve medium-level problems in 15-30 minutes and tackle hard ones within 30-45 minutes, you'll be well-prepared to apply for positions at various companies.