Competitive programming is a mind sport usually held over the Internet or a local network, involving participants trying to program according to provided specifications.
Competitive programming combines two topics: the design of algorithms and the implementation of algorithms
The core of competitive programming is about inventing efficient algorithms that solve well-defined computational problems. The design of algorithms requires problem solving and mathematical skills. Often a solution to a problem is a combination of well-known methods and new insights.
In competitive programming, the solutions to problems are evaluated by testing an implemented algorithm using a set of test cases. Thus, after coming up with an algorithm that solves the problem, the next step is to correctly implement it, which requires good programming skills.
- HackerRank
- Hackerearth
- Codeforces
- Codechef
- Atcoder
- SPOJ
- LeetCode
- Coding Ninjas
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.
