Let’s consider cricket for a while. You walk into bat for the first time. Bowler swings and you miss. You practice by keeping this “swing” in your mind and next time you’ll do much better. By practicing and doing it a couple of times, you’ll hit one over the ropes.
In a programming contest, you convert plain English sentences into a code of your favorite programming language. Walk right into it, you will learn unwritten rules of the game as you play harder and get better.
For getting started, you just need to know a programming language and start competing. As you practice, you fail, and you succeed and you will learn how to solve complex problems and how to write fast and efficient code.
- Improves Logic
Programming logic improves by practice. You are smart from the very beginning. With competitive programming, you continuously train yourself with problems that test the better out of your current logic skills. By practicing more and more you get better and this improves your programming logic.
- Makes you more focused and faster
Thinking about a problem and finding its solution makes you more focused. With an improved logic, you will be able to think faster, solve problems faster, decide faster and put your thinking and solutions into code faster without going to and fro thinking which approach to use for your code.
- Helps you solve complicated problems
By doing CP you will learn how to solve complex tasks out of the ordinary tasks. This will help prepare you for a job because you can adapt and solve various kinds of problems in various types of situations.
- Teaches you how to work in teams
CP helps you learn how to effectively work together, as you must work with others on your team to complete the same task. In this situation, you will learn how to assess your team member’s strength and weakness and effectively divide responsibilities between each other.
- Make you a desirable candidate for major companies
Participating in CP contests makes you a desirable candidate for big companies. In CP organizer websites and companies, these big companies always have a look and they pick the candidates with high potential and with the best ability to solve complex tasks.
Recursion can be defined as the technique of replicating or doing again an activity in a self-similar way calling itself again and again, and the process continues till specific condition reaches. In the world of programming, when your program lets you call that specific function from inside that function, then this concept of calling the function from itself can be termed as recursion, and the function which makes this possible is called recursive function.
In divide and conquer approach, the problem in hand, is divided into smaller sub-problems and then each problem is solved independently. When we keep on dividing the subproblems into even smaller sub-problems, we may eventually reach a stage where no more division is possible. Those "atomic" smallest possible sub-problem (fractions) are solved. The solution of all sub-problems is finally merged in order to obtain the solution of an original problem.
Among all the approaches, the simplest and straightforward approach is the Greedy method. In this approach, the decision is taken on the basis of current available information without worrying about the effect of the current decision in future.
Dynamic programming is a technique that breaks the problems into sub-problems, and saves the result for future purposes so that we do not need to compute the result again. The subproblems are optimized to optimize the overall solution is known as optimal substructure property.
The main use of dynamic programming is to solve optimization problems. Here, optimization problems mean that when we are trying to find out the minimum or the maximum solution of a problem. The dynamic programming guarantees to find the optimal solution of a problem if the solution exists.
APPROACH | Repository Folder Link | Solved Examples |
---|---|---|
RECURSION | Repo | Examples |
DIVIDE AND CONQUER | Repo | Examples |
GREEDY APPROACH | Repo | Examples |
DYNAMIC PROGRAMMING | Repo | Examples |
Codeforces
Codechef
Atcoder
Topcoder
Hackerearth
Hackerank
Some other useful websites:
To keep track of all coding competitions
Theory and implementation of CP approaches
Common problems asked in competitions
Google Codejam
Google Kickstart
Facebook Hackercup