**And finding the right motivation is essential, because learning to program ***well* takes a lot of work.

**So my first piece of advice is: reflect on ***why*** you want to write software and ***what*** kind of software you want to write.**

- ALGORITHM TUTORIAL
- Have a look at this answer : Anudeep Nekkanti’s answer to What was Anudeep Nekkanti’s Competitive Programming strategy to become 35th in Global ranking, in just 6-7 months?
- And this post : Data Structures and Algorithms

If you get addicted to programming and would like to spend some time to enhance programming in India, let me know 🙂
- What-trick-about-algorithms-or-about-competitive-coding-in-general-can-you-learn-in-10-20-minutes-that-will-be-useful-later-on
- if-I-have-1-year-to-prepare-for-a-Google-software-engineer-interview-how-should-I-prepare
- How-much-time-is-reasonable-to-tell-Google-for-your-preparation-for-the-interview
- How-do-I-attain-the-level-of-mathematics-required-for-the-ICPC
- For comprehensiveness, here are a list of items (they are kind of random; I’m not an expert in maths anyways) which I think would be helpful for solving easy-to-medium problems in ICPC. Some of these would repeat what Brian Bihas listed in his answer:
- Basic probability: Applications of certain DP problems, …
- Basic counting: Applications of combination (nCr), permutation (nPr), factorial (n!), ideally also multinomial coefficients, …
- Basic geometry: Dot products, cross products, intersection of two lines, convex hulls, …
- Basic number theory: GCD/LCM, generating primes <= N, modulo congruence, modulo inverse, … my answer to What important topics of number theory should every programmer know?

- I have found http://prismoskills.appspot.com/ to be very useful when preparing for today’s interviews. Some of the very hot topics it covers are:

- Dynamic Programming (Many good examples, thoroughly covered)
- Binary Trees
- Arrays and Lists
- Java, Collections, Multithreading, Garbage collection and JVM tuning
- Algorithms
- Bitwise operators
- Artificial Intelligence and Pattern matching (Touches some topics in these areas, but enough to get through Google, Facebook interviews).

If you can go through all of its content, you would be very close to your target I would say.

Also you can add your own content to it to make it easier for you to return to it later on.

1. For Data Structures, “UNDERSTAND” all the concepts from here Data Structures – GeeksforGeeks.

2. Try your hand at the online judge, especially LeetCode

3. For Algorithms, read this Introduction to Algorithm by T.H Corman

4. Read the book Cracking the interview by gayle.

Now coming to the part where you probably are thinking **” How the hell should I start off with all this ? “**

There is nothing new that I would be able to tell you. So I would rather quote what Anudeep Nekkanti has to say :

**If I am to start programming now, I would do it this way**

- Solve 200 most solved problems on SPOJ, Problem by problem. In 2 months.

*(This will teach all standard problems, algorithms and implementation skills)*
- Solve problems from CodeChef and CodeForces for 2 months.

*(This will teach variations, we can read others solutions and learn better ways. Skip easy problems)*
- Solve problems from TopCoder for 2 months.

*(This will teach Dynamic Programming. Div 1 500p)*
- Check past ACM ICPC Regional’s Problems

*(Great quality problems)*

**If I am to learn a new Algorithm now, I would do it this way**

- Read it from at least 3-4 different sources.
- Understand correctness proof and run-time analysis.

*(This is very very important, you will know it only when you deal with non standard and hard problems)*
- Question yourself on every step for correctness. Try to tweak the implementation.
- Check other implementations

You need to refer to external links, tutorials, books, research papers, etc. on various topics like for Data Structures and Algorithms you need to studyGreedy Approaches, Divide and Conquer, Constructive/Iterative Algorithms, Graphs, Trees and other Data Structures… and some of the tough ones like, Ropes, Segmentation Trees, etc. which you will eventually learn after much of your efforts….. apart from this you need to build your mathematical basics to the best, to utilize your capabilities, including series(Fibonacci, Catalan, AP, GP, HP etc.), formulas, Probability, Permutation, Combination etc…. Sometimes there is a requirement some other subjects(like Physics) but most of relevant information is provided in the question itself….

And for your purpose of being a “Good Programmer”…. don’t ever try to copy codes…. even if you are looking some editorial or research papers… try to study the logic and then write the code yourself…. Try to study the codes of other coders… if you cant understand them… just try to print the intermediate results to understand the logic behind each line…. One thing which may effect you during the competitive programming is cheating… to overcome this you can take a print out of the relevant resources and try to solve things by hand…. for more purposes use discussion forums to solve your problems, there are so many awesome coder and top performers which are thirsty of solving your doubts 😛 ….

As far as resources are concerned, some of the best ones that I have found so far are

Data Structures and Algorithms

MAXimal :: algo

What are the “must known” algorithms for online programming contests?

Now Google ” ‘language name’ basic projects source code”

Go through the links on the first page. And try understanding the source code. Google what you don’t get. 2 hours will be sufficient for going through at least 3 small projects.

Practice from codechef.com or problems from spoj.

List of Hello world program examples

What kind of jobs do the software engineers who earn $500K a year do? – Amin Ariana

thenewboston

Who told you that you can select only one of them? You can actually be good at both of them. In fact, your programming experience boosts your general programming skills. Whether it is competitive programming or “real life programming”, at the end of the day they make you a better programmer.

Talking about advantages, there are quite a few. I will try my best to list them out.

**Competitive programming teaches you how to think**. Once you start doing a lot of competitive programming, you will realize the importance and power of thinking. You will realize that spending a little bit more time in the thinking phase will save you a lot of time in the debugging phase. Also, you will start thinking algorithmically which is crucial for solving many real-world problems.
**Competitive programming teaches you to code faster and make less mistakes.** Many a time, in a programming contest, it comes down to who can code the fastest and with less mistakes (so you spend lesser time debugging). If everyone can solve a particular problem, then the coding + debugging time becomes the only deciding factor.
**Competitive programming improves your confidence.**

But, there is a disadvantage (which can be avoided):

**Competitive programming teaches you bad coding practices.** If you read someone’s solution on any competitive programming website, you will find that, more often than not, you will not understand what is going on. This is due to the use of macros in place of frequently used constructs, keywords, function calls etc. to save typing time. As a beginner you might be tempted to use them thinking that it will hugely bring down your coding time but in reality it does not matter. What matters is how fast you can come up with the algorithm. If you don’t believe you can look at tourist’s andPetr’s submissions on Codeforces and notice that they don’t use any kind of shortcuts like macros.

At the end of the day, when you start “real world programming” after a long exposure to competitive programming you will find it to be very simple and trivial sometimes to the extent that certain things will actually bore you because they are not challenging enough.

The journey:

- Summer 2013: Started to revise the course Data Structures and Algorithms, which I undertook in 2nd year. Started coding my own implementations of trees, binary trees, binary search trees, stacks, queues.
- Realized competitive programming was about much more. Wrote my 1st BFS and DFS, submitted on SPOJ and became elated. Then some easiest problems on codechef. The green tick was orgasmic.
- Got acquainted with the vast world of Dynamic programming. Started to learn DP, read topcoder tutorial on DP, searched for easy DP problems – Tried them, could do only 2/10. Demotivated. Thought DP was not my cup of tea. Gave up on DP.
- Learnt about segment trees from a codechef editorial. Read a tutorial on segment trees. Implemented my own version (took about 3-4 days of debugging). Submitted on SPOJ. – 8 wrong submissions. Thought of coming back to segment trees after a while.
- Started to learn DP, read DP chapter in CLRS, read topcoder tutorials, searched for easy DP problems – Tried them, could do only 5/10. Tried some DP problems on SPOJ. Couldn’t do a single one. Thought of coming back some other time.
- Back to segment trees. This time got accepted on SPOJ and segment tree became my favorite data structure.
- Qualified for ACM-ICPC Amritapuri regionals.
- Picked up DP again. 8 days of intense DP. Did about 8-9 DP problems on SPOJ.
- Participated in ICPC regionals. Performed poorly. Team ranked #224.
- Following that a little bit of Topcoder/Codeforces/Codechef/SPOJ. Greatly inspired by Mohd Asad my senior, who gave up his summer intern to work on competitive programming.
- As expected, companies like Amazon and Microsoft that visited campus for internships didn’t open up for my branch. No remorse/regret/care in this world because I was enjoying what I was doing. Didn’t really know or care if competitive programming would get me a job.
- Finally, got a work from home internship at a Start-up based in San Francisco in the summer of 2014; all thanks to User. It required me to work on algorithms and data structures. Learnt a lot and more importantly understood the code quality difference between competitive programmingand production level code. Realized that more often than not, I would not be working with fancy algorithms and Data Structures at a full time job – i.e. that the world of competitive programming is very different from actual software engineering jobs. Embraced the fact.
- Fourth year: Placement preparations specifically.

Geeksforgeeks/leetcode/cracking the coding interview etc. Didn’t enjoy much of this phase though, because I wasn’t able to give time to realcompetitive programming. Realized I was starting to become comfortable with DP.
- Google APAC, August Round: Rank 221. Not called.
- Google APAC, September Round: Rank 122. Called for personal interviews.
- Google Gurgaon office, October 28:

*Google Interview experience in short.*

4 Interviews with 2 questions each. Each round ranging from 45 min. to 1 hour 15 min.
**Interview 1:**

** **Question 1: Dynamic Programming ( A Day at Gaushala Maidan :p )

** **Question 2: AdHoc – Strings
**Interview 2:**

** **Question 1: Dynamic Programming

** **Question 2: Dynamic Programming
**Shortlisted for round 3.**
**Interview 3:**

** **Question 1: Breadth-First Search

Question 2: Open-ended/Design Question (I used heaps)
**Shortlisted for round 4.**
**Interview 4:**

** **Question 1: Trees (IITJ Shutterbugs – rings a bell?)

Question 2: AdHoc – I used Heaps/HashMaps

- November 4: Google HR calls me to ask about my branch, location preferences and transcripts.
- November 7, 12:30 hrs: HR calls me to congratulate me on acceptance of my application. Tells me I will be joining
**Google India**. E-Mail follows. Can’t stop shaking.
- Night of November 7: Party straight for 7 hours. People in the adjacent building said that they couldn’t sleep because of the noise.

3 Ask to Answers. Hope I have done justice to the question. Please comment if you want me to add something.

**Edit 1:** Since many are asking for my advice on how to start competitive programming, these are some of the answers that have inspired me:

**Edit 2: **I have a very modest pay package, good enough for a fresher. **Not** the 50 lakhs or 1.4 crore sorts. There are many people here on Quora, who deserve much more fame than I am receiving right now.

**Edit 3: **10 easy DP problems, I talked about. Here they are:

Dynamic Programming Practice Problems

1) TopCoder Feature Articles

2) TopCoder Feature Articles

I will go one step further and will give a practical advice. Buy a Raspberry Pi kit and start working on a cool new project. You have some ideas here –Raspberry Pi Projects and there are plenty of magazines devoted to cool new ideas that can be done very cheaply – Download your RasPi project files.