{"id":998,"date":"2016-09-11T16:36:46","date_gmt":"2016-09-11T11:06:46","guid":{"rendered":"http:\/\/abhinav.spsdarj.org\/?p=998"},"modified":"2017-01-16T09:56:42","modified_gmt":"2017-01-16T04:26:42","slug":"what-is-the-best-strategy-to-improve-my-skills-in-competitive-programming-in-2-3-months","status":"publish","type":"post","link":"https:\/\/abhinavkr.com\/musings\/2016\/09\/what-is-the-best-strategy-to-improve-my-skills-in-competitive-programming-in-2-3-months\/","title":{"rendered":"What is the best strategy to improve my skills in competitive programming in 2-3 months?"},"content":{"rendered":"<p><span class=\"rendered_qtext\"><span class=\"rendered_qtext\">Answer by Sachin Gupta:<\/span><\/span><\/p>\n<blockquote><p><b><i>This post has been taken from the blog post\u00a0 <\/i><\/b><span class=\"qlink_container\"><a class=\"external_link broken_link\" href=\"http:\/\/blog.hackerearth.com\/2013\/09\/competitive-programming-getting-started_11.html\" target=\"_blank\" rel=\"noopener nofollow\"><i>Learn to Code by Competitive Programming<\/i><\/a><\/span><b><i> written by <\/i><\/b><span class=\"qlink_container\"><a href=\"https:\/\/www.quora.com\/profile\/MV-Kaushik\" class=\"broken_link\"><i>MV Kaushik<\/i><\/a><\/span><b><i> when he was interning at <\/i><\/b><span class=\"qlink_container\"><a href=\"https:\/\/www.quora.com\/topic\/HackerEarth\" class=\"broken_link\"><i>HackerEarth<\/i><\/a><\/span><\/p>\n<p><b>Here are some steps to get started and be good at it.<\/b><\/p>\n<ul>\n<ul>\n<li>Get comfortable writing code in either of one of these languages <b>C, C++ or Java<\/b>. Why only C, C++ or Java? Because these are the standard languages allowed in any programming competition.<\/li>\n<li>If you are already good at C, it is suggested to <b>learn C++<\/b>. It is the most popular language among competitive programmers because of its speed and an excellent library in the form of <span class=\"qlink_container\"><a class=\"external_link\" href=\"http:\/\/www.sgi.com\/tech\/stl\/\" target=\"_blank\" rel=\"noopener nofollow\">STL<\/a><\/span> (Standard Template Library).<\/li>\n<li>Pick an online judge. Recommended ones are<b> <\/b><span class=\"qlink_container\"><a class=\"external_link broken_link\" href=\"http:\/\/community.topcoder.com\/tc\" target=\"_blank\" rel=\"noopener nofollow\"><b>Topcoder<\/b><\/a><\/span> and <span class=\"qlink_container\"><a class=\"external_link\" href=\"http:\/\/codeforces.com\/\" target=\"_blank\" rel=\"noopener nofollow\"><b>Codeforces<\/b><\/a><\/span>. These sites have high quality of problems and also allow you to see other\u2019s code post contest completion. These also categorize problems based on the topic. Some other popular judges include <span class=\"qlink_container\"><a class=\"external_link broken_link\" href=\"http:\/\/www.spoj.com\/\" target=\"_blank\" rel=\"noopener nofollow\">SPOJ<\/a><\/span>, <span class=\"qlink_container\"><a class=\"external_link\" href=\"http:\/\/codechef.com\/\" target=\"_blank\" rel=\"noopener nofollow\">CodeChef<\/a><\/span> (powered by SPOJ) and<span class=\"qlink_container\"><a class=\"external_link broken_link\" href=\"http:\/\/www.hackerearth.com\/\" target=\"_blank\" rel=\"noopener nofollow\">HackerEarth<\/a><\/span>.<\/li>\n<li>To begin with, <b>start with simple problems<\/b> that typically require transformingEnglish to code and does not require any knowledge on algorithms. Solving <span class=\"qlink_container\"><a class=\"external_link broken_link\" href=\"http:\/\/community.topcoder.com\/tc?module=ProblemArchive&amp;sr=&amp;er=&amp;sc=&amp;sd=&amp;class=&amp;cat=&amp;div1l=&amp;div2l=1&amp;mind1s=&amp;mind2s=&amp;maxd1s=&amp;maxd2s=&amp;wr=\" target=\"_blank\" rel=\"noopener nofollow\">Div 2 250<\/a><\/span> (Division 2, 250 points) in Topcoder or Div 2 Problem A in Codeforces is a good start.<\/li>\n<li>At the early stages of programming one tends to write long pieces of code, which is actually not required. Try to keep codes <b>short and simple<\/b>.<\/li>\n<li><b>Practice<\/b> these problems until you become comfortable that you can submit it for 240 odd points on any day.<\/li>\n<li>Start implementing basic(or standard) algorithms. It is suggested to read them from<span class=\"qlink_container\"><a class=\"external_link broken_link\" href=\"http:\/\/community.topcoder.com\/tc?module=Static&amp;d1=tutorials&amp;d2=alg_index\" target=\"_blank\" rel=\"noopener nofollow\"><b> Topcoder tutorials<\/b><\/a><\/span> or <span class=\"qlink_container\"><a class=\"external_link\" href=\"http:\/\/www.amazon.com\/Introduction-Algorithms-Thomas-H-Cormen\/dp\/0262033844\" target=\"_blank\" rel=\"noopener\"><b>Introduction to algorithms<\/b><\/a><\/span><b>.<\/b>\n<p>1) Graph algorithms: Breadth first search(BFS), Depth first search(DFS), Strongly connected components(SCC), Dijkstra, Floyd-Warshall, Minimum spanning tree(MST), Topological sort.<\/p>\n<p>2) Dynamic programming: Standard dynamic programming problems such as Rod Cutting, Knapsack, Matrix chain multiplication etc.<\/p>\n<p>3) Number theory: Modular arithmetic, Fermat\u2019s theorem, Chinese remainder theorem(CRT), Euclidian method for GCD, Logarithmic<br \/>\nExponentiation, Sieve of Eratosthenes, Euler\u2019s totient function.<\/p>\n<p>3) Greedy:\u00a0 Standard problems such as Activity selection.<\/p>\n<p>4) Search techniques: <span class=\"qlink_container\"><a href=\"https:\/\/www.quora.com\/How-do-I-do-well-in-competitive-programming\" class=\"broken_link\">Binary<\/a><\/span> search, Ternary search and Meet in the middle.<\/p>\n<p>5) Data structures (Basic): Stacks, Queues, Trees and Heaps.<\/p>\n<p>6) Data structures (Advanced): Trie, Segment trees, Fenwick tree or <span class=\"qlink_container\"><a href=\"https:\/\/www.quora.com\/How-do-I-do-well-in-competitive-programming\" class=\"broken_link\">Binary<\/a><\/span> indexed tree(BIT), Disjoint data structures.<\/p>\n<p>7) Strings: Knuth Morris Pratt(KMP), Z algorithm, Suffix arrays\/Suffix trees. These are bit advanced algorithms.<\/p>\n<p>8) Computational geometry: Graham-Scan for convex hull, Line sweep.<\/p>\n<p>9) Game theory: Basic principles of Nim game, Grundy numbers, Sprague-Grundy theorem.<\/p>\n<p>The list is not complete but these are the ones that you encounter very frequently in the contests. There are other algorithms but are required very rarely in the contests.<\/li>\n<li>You can find description and implementation of standard algorithms <span class=\"qlink_container\"><a class=\"external_link\" href=\"http:\/\/e-maxx.ru\/algo\/\" target=\"_blank\" rel=\"noopener nofollow\">here<\/a><\/span><\/li>\n<li>Once you have sufficient knowledge of popular algorithms, you can start solving the medium level problems. That is Div 2 all problems in Topcoder and Codeforces. It is advisable not to go for Div 1 500 at this point.<\/li>\n<li>Learning to code is all about practicing.<b> Participate regularly<\/b> in the programming contests. Solve the ones that you cannot solve in the contest, after the contest. Apart from Topcoder and Codeforces you can also look at <span class=\"qlink_container\"><a class=\"external_link broken_link\" href=\"http:\/\/www.hackerearth.com\/challenges\/\" target=\"_blank\" rel=\"noopener nofollow\">HackerEarth Challenges<\/a><\/span>or <span class=\"qlink_container\"><a class=\"external_link\" href=\"http:\/\/www.codechef.com\/contests\" target=\"_blank\" rel=\"noopener nofollow\">Codechef contests<\/a><\/span>.<\/li>\n<li><b>Read the codes<\/b> of high rated programmers. Compare your solution with them. You can observe that it is simple and shorter than your solution. Analyse how they have approached and improve your implementation skills.<\/li>\n<li><b>Read the editorials<\/b> after the contest. You can learn how to solve the problems that you were not able to solve in the contest and learn alternative ways to solve the problems which you could solve.<\/li>\n<li>Always <b>practice the problems that you could solve in the contest<\/b>. Suppose if you are able to solve Div 2 250 and 500 in the contest but not Div 2 1000 then practice as many Div 2 1000 problems as as you can.<\/li>\n<li><b>Do not spend too much time<\/b> if you are not getting the solution or are stuck somewhere.<\/li>\n<li>After you feel that you have spent enough time, look at the editorials. Understand the algorithm and code it. Do not look at the actual solution before you have attempted to write the code on your own.<\/li>\n<li>Programming is a very practical and hands on skill. You have to continuously do it to be good at it. It\u2019s not enough to solve the problem theoretically, <b>you have to<\/b> <b>code it and get the solution accepted<\/b>. Knowing which algorithm\/logic to use and implementing it are two different things. It takes both to be good at programming.<\/li>\n<li>Programming learning phase is going to take a lot of time and the key is <b>practicing regularly<\/b>. It takes some time before you can attempt Div 1 500 and other tough problems. Do not give up on reading the editorials and implementing them, even if it takes many hours\/days. Remember everything requires practice to master it.<\/li>\n<\/ul>\n<\/ul>\n<p>It takes considerable amount of time before you get good at it. You have to keep yourself motivated throughout. Forming a team and practicing is a good choice. <b>Not giving up is the key here.<\/b><\/p><\/blockquote>\n<p><span class=\"rendered_qtext\"><span class=\"qlink_container\"><a href=\"https:\/\/www.quora.com\/What-is-the-best-strategy-to-improve-my-skills-in-competitive-programming-in-2-3-months\/answer\/Sachin-Gupta-6\" class=\"broken_link\">What is the best strategy to improve my skills in competitive programming in 2-3 months?<\/a><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Answer by Sachin Gupta: This post has been taken from the blog post\u00a0 Learn to Code by Competitive Programming written by MV Kaushik when he was interning at HackerEarth Here are some steps to get started and be good at it. Get comfortable writing code in either of one of these languages C, C++ or&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,11,189],"tags":[230],"class_list":["post-998","post","type-post","status-publish","format-standard","hentry","category-knowledge","category-quora-post","category-tech","tag-programming"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4KGvB-g6","jetpack-related-posts":[{"id":564,"url":"https:\/\/abhinavkr.com\/musings\/2014\/08\/be-a-good-programmer\/","url_meta":{"origin":998,"position":0},"title":"Be a good Programmer","author":"Abhinav","date":"August 24, 2014","format":false,"excerpt":"Recommendations for Academic Learning Introduction to CS Course Notes: Introduction to Computer Science Course that provides instructions on coding. Online Resources: Udacity- \u00a0Intro to CS course, Coursera - Computer Science 101 Code in at least one object oriented programming language: C++, Java, or Python Beginner Online Resources: Coursera - Learn\u2026","rel":"","context":"In &quot;Knowledge&quot;","block_context":{"text":"Knowledge","link":"https:\/\/abhinavkr.com\/musings\/category\/knowledge\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":986,"url":"https:\/\/abhinavkr.com\/musings\/2016\/08\/what-was-anudeep-nekkantis-competitive-programming-strategy-to-become-35th-in-global-ranking-in-just-6-7-months\/","url_meta":{"origin":998,"position":1},"title":"What was Anudeep Nekkanti&#8217;s Competitive Programming strategy to become 35th in Global ranking, in just 6-7 months?","author":"Abhinav","date":"August 19, 2016","format":false,"excerpt":"Answer by Anudeep Nekkanti: What I did ? Solved about 300 problems on SPOJ in this order - Sphere Online Judge (SPOJ) Result ? Became very good with C++ and STL Got introduced to most Competitive programming KEYWORDS (like DP, maxflow, sets, hashing, etc) Learned Standard Problems and Algorithms Indenting\u2026","rel":"","context":"In &quot;Knowledge&quot;","block_context":{"text":"Knowledge","link":"https:\/\/abhinavkr.com\/musings\/category\/knowledge\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":646,"url":"https:\/\/abhinavkr.com\/musings\/2014\/10\/what-does-it-feel-like-to-be-poor\/","url_meta":{"origin":998,"position":2},"title":"What does it feel like to be poor?","author":"Abhinav","date":"October 31, 2014","format":false,"excerpt":"Answer by Anonymous: I was born into family of lower middle class .We are two girls and I'm the Elder one.- Dad and his family are against Girls education and career. I was consistently class topper and excelled in many extra-curricular, But always been put down\u00a0 - \" Learn cooking\u2026","rel":"","context":"In &quot;Quora Post&quot;","block_context":{"text":"Quora Post","link":"https:\/\/abhinavkr.com\/musings\/category\/quora-post\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":681,"url":"https:\/\/abhinavkr.com\/musings\/2015\/02\/how-did-mark-zuckerberg-train-himself-to-be-a-programming-prodigy\/","url_meta":{"origin":998,"position":3},"title":"How did Mark Zuckerberg train himself to be a programming prodigy?","author":"Abhinav","date":"February 8, 2015","format":false,"excerpt":"Answer by Mike Hughes: Just because Mark started Facebook doesn't mean he is a programming prodigy. Mark's major was Pyschology so he wasn't at Harvard as a CompSci prodigy. Back in 2004 building a CRUD (Create, Read, Update, Delete) application in PHP\/MySQL was fairly easy. I would bet if you\u2026","rel":"","context":"In &quot;Knowledge&quot;","block_context":{"text":"Knowledge","link":"https:\/\/abhinavkr.com\/musings\/category\/knowledge\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":691,"url":"https:\/\/abhinavkr.com\/musings\/2015\/02\/what-are-the-best-kept-secrets-of-great-programmers\/","url_meta":{"origin":998,"position":4},"title":"What are the best-kept secrets of great programmers?","author":"Abhinav","date":"February 11, 2015","format":false,"excerpt":"Answer by Jeff Darcy: Never reveal all that you know. OK, seriously this time.\u00a0 I think there are really a few things that distinguish great programmers. Know the concepts.\u00a0 Solving a problem via memory or pattern recognition is much faster than solving it by reason alone.\u00a0 If you've solved a\u2026","rel":"","context":"In &quot;Knowledge&quot;","block_context":{"text":"Knowledge","link":"https:\/\/abhinavkr.com\/musings\/category\/knowledge\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":967,"url":"https:\/\/abhinavkr.com\/musings\/2016\/07\/what-is-the-latest-fad-among-the-youth-of-india\/","url_meta":{"origin":998,"position":5},"title":"What is the latest fad among the youth of India?","author":"Abhinav","date":"July 25, 2016","format":false,"excerpt":"What is the latest fad among the youth of India? by @iAmoghAnswer by Amogh Talpallikar:Let me take this opportunity to highlight a trend that I have observed on social media among young Indian IT \u201cprofessionals\u201d.They grow up having not explored nooks and corners of their heart to find out what\u2026","rel":"","context":"In &quot;Fun Stuff&quot;","block_context":{"text":"Fun Stuff","link":"https:\/\/abhinavkr.com\/musings\/category\/fun-stuff\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/posts\/998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/comments?post=998"}],"version-history":[{"count":2,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/posts\/998\/revisions"}],"predecessor-version":[{"id":1287,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/posts\/998\/revisions\/1287"}],"wp:attachment":[{"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/media?parent=998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/categories?post=998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/tags?post=998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}