-
Notifications
You must be signed in to change notification settings - Fork 522
How to practice?
Just practice. Solve problems, solve problems and solve some more problems. By doing it, you will also learn new algorithms and techniques.
If you're a beginner, read Competitive Programmer's Handbook.
Everything below is written with competitive programming in mind, but practicing for coding interviews is similar. Your goal should be to get better at algorithms and data structures.
Solve problems slightly above your level - those that aren't easy for you but you can usually solve them. If you are stuck for 20-30 minutes (an hour in case of harder problems), read an editorial and make sure you understand it. Implement a solution and if you struggled then go read other people's codes - see how they did it easier. Note the word "stuck" in bold. If you aren't out of ideas then you aren't stuck. You can give up only if you didn't do any progress for some time.
Upsolve problems you didn't solve during a contest. Not all of them, just one-two more. Don't try something very hard because you likely won't solve it. You will eventually learn enough to tackle those hard problems.
Use Google to find some tutorials and read them. Solve problems on that topic. After a while, go back to solving random problems. You should now be able to recognize similar problems and apply the new algorithm/technique you learned.
For smaller algorithms/techniques, it's enough to solve a few problems to understand it well enough. In case of big topics (categories) like dynamic programming, you should solve tens of problems. But don't spend months on that because you cheat a little bit by knowing what you should use in a problem. When you read a problem during a contest, you don't know its tags/topics. Sometimes the hard part is to come up with what you should use. Recognizing patterns is a valuable skill and that's why you need to mainly solve random problems.
Just solve problems. If there is some algorithm you should know, you will eventually encounter it. Then search for some tutorials and similar problems.
The platform doesn't matter much but it's good to solve problems with editorials (and public codes of other people). That will make you learn faster.
For beginners, I recommend Codeforces educational rounds and Atcoder Beginner Contests (ABC). You will encounter a lot of standard problems and thus you will learn important techniques. The statements are not convoluted and that's another plus. There are no English editorials for ABC but you can use google translate from Japanese, or you can read submissions by people from the top. Nowadays, ABC has English editorials after a few days, sometimes posted by Geothermal on CF, https://codeforces.com/blog/Geothermal.
Focus on solving old problems from this competition. Don't worry too much about it though. It's still just about being good at algorithms. Solving problems from other contests isn't a waste of time.
For excelling in IOI, make sure you know everything from the syllabus.
To get better in ICPC, you should obviously solve some old team contests with a team. Read more here.
- Whole directory with detailed instructions from two-times IOI winner, Benq
- A way to Practice Competitive Programming: From Rating 1000 to 2400+
- The 'science' of training in competitive programming
- Yet another similar blog
- Topcoder tutorials - a few first articles are about approaching a problem, like "How To Dissect a Topcoder Problem Statement".