Practice, practice, and practice.
During my 2nd-year summer internship, I spent a lot of time practicing Data Structures and Algorithms because it is the most important topic to crack coding interviews for jobs and internships. Here are some of the resources that I used:
- Topcoder: Topcoder is a great resource to study tutorials on Data Structures and Algorithms and solve practice problems. You can also find solutions to various Topcoder problems. Topcoder has one of the best archives of problems on Dynamic Programming.
- SPOJ: It is one of the best resources for practicing problems in Data Structures and Algorithms. Solve the 200 most solved problems on SPOJ and you are sure to get a firm command on 80% of the topics.
- Cracking the Coding Interview: While this book focuses on interview preparation, it does a wonderful job in helping you practice some great Data Structures and Algorithms related problems.
- Princeton University’s course on Coursera: This course by Robert Sedgewick is an excellent course. It teaches programming in Java. But then you can always code it in whichever language you know.
- InterviewBit: Again an excellent resource for practicing problems. The focus like other platforms is on interview problems. But, the problems revolve around Data Structures and Algorithms.
- Codeforces: I never really participated in the contests, but I certainly solved problems filtered by topics/tags. For instance, Dynamic Programming, etc.
If I were to do it all again, here is what I’d do:
- Create a list of topics that I want to study. For instance, the list could look something like - stacks, queues, graphs, dynamic programming, divide and conquer, etc.
- Identify a great resource for each of the topics on the list and thoroughly study it.
- Solve at least 5 easy problems, 10 medium-level problems, and 5 difficult problems for each of the topic. Assuming a total of 15 topics, this requires some 300 problems to be solved, which according to me is a fair number that a normal person would need to get to a certain level.
I never really focused on Competitive Programming as such. My focus was always on Data Structures and Algorithms as a general concept and Interview Preparation. However, if you like Competitive Programming, you may additionally want to participate in the coding contests held online on Codeforces, Codechef, etc.