# Competitive Programming – A Complete Guide

** Competitive Programming** is a mental sport that enables you to code a given problem under provided constraints. The purpose of this article is to guide every individual possessing a desire to excel in this sport. This article provides a detailed syllabus for Competitive Programming designed by industry experts to boost the preparation of the readers.

**Related Course**

**Related Course**

## Competitive Programming – Live Course

Get ready to level up your programming skills with this

. Learn theCompetitive Programming – Live Course, and much more. So, why wait? Dive into the world of Programming by enrolling in this course today!Fundamentals of programming, DSA, Mathematical algorithms

Table of Content

- What is Competitive Programming?
- Basics of Competitive Programming
- Basics Of Array , String, Greedy and Bit Manipulation
- Number Theory and Combinatorics
- Searching, Sorting and Basic Data Structures
- Tree and Graphs
- Recursion and Dynamic Programming
- String Algorithms
- Geometry and Game Theory
- Advance Data Structures

## What is Competitive Programming?

Â is aÂCompetitive programming, where people compete against each other to solve some programming questions/logic with an efficient approach and within a time constraint. The goal of competitive programming is to write code to solve a problem within a given timeframe.Âmind sport

# Why Should You Do Competitive Programming?

Competitive programming is the best way to master yourÂ ** analytical thinking,**Â andÂ

**Â and improve your coding skills. It is now being considered by many tech giants likeÂ**

**logical thinking****Â andÂ****Google**

**.Â Also,****Facebook**

**Â organizes theÂ****Facebook**

**annually to promote all the Competitive Programmers around the world to compete against one another and earn a chance to get hired at Meta.**

**Meta Hacker Cup**Here are some reasons about why you should start Competitive Programming:

By practicing competitive programming, you start thinking quickly and within the given timeframe and this improves your mental agility and helps enhance your thinking ability.**Mental Agility and Quick Thinking:**Competitive programming can be fun for those who enjoy the thrill of competition. Solving challenging problems that too within a timeframeÂ**Competitive Spirit:**Â and a sense of accomplishment.**boosts confidence**Competitive programmingÂ is very important when it comes to technical interviews for software engineering-related jobs.Â Many tech giants use competitive programming contests as a medium of recruitment. Companies like**Career Prospect:**,Â**Google**,Â**ServiceNow**, etc. haveÂ technical interviewsÂ based on competitive programming problems.**Atlassian**In Competitive programming, we get a wide range of variety of problems andÂ**Learning Opportunity:**. Competitive programming exposes various data structures and algorithms which help us better understand the complexity of problems.**various arithmetic concepts**Competitive programming is one of the best ways to grow as a programmer. It helps you get a command over problem-solving, as youâ€™ve to solve challenging problems within a time limit.Â**Personal Growth as a Programmer:**Participating in various coding contests gives you a chance to be a part of communities with like-minded people. Here in these communities, you get various important resources and guidance from experts who can help you get so many opportunities like referrals, job-opening information, mentorship, etc.Â**Networking:**

**Basics of Competitive Programming:**

**Basics of Competitive Programming:**

**What is Competitive Programming and How to Prepare for It?****Competitive Programming (CP) Handbook with Complete Roadmap****Fast I/O:****CPP****,Â****Java****,****Python****Useful libraries:**,**CPP**,**Java****Python****Input/Output Files:****Set 1****,****Set 2****Tips and Tricks:****Set 1****,****Set 2****Input Methods:****CPP****,****Java****,****Python****Template:****CPP****Language:****CPP****,**,**Java****Python****Time Complexity:****Analysis****Â****Setting up Competitive Programming Environment:**,**Sublime: CPP****Visual Studio: CPP and Python****CSES Problem Set**

**Basics Of Array , String, Greedy and Bit Manipulation**

**Basics Of Array , String, Greedy and Bit Manipulation**

(Related Problems:**Reverse an array****Problem 1****,**)**Problem 2****Sum of Digits****Program to Check if a Given String is Palindrome in C,**(Related**Python**)**Problem**(Related**Sum of array elements**)**Problem**(Related**Maximum and Minimum element of array**)**Problem**(Related Problems:**Counting frequencies of array elements****Problem 1****,**)**Problem 2****Float and Precision:****CPP****,****Java****,****Python****Prefix sum****,**,**2D Prefix Sum****Difference Array | Range update query in O(1)**(Related Problems:**:****Problem 1****,**)**Problem 2****Coordinate Compression**(Related**:**)**Problem****Kadane Algorithm**(Related**:**)**Problem**: (Related**Activity Selection Problem**)**Problem**: (Related**Job Sequencing Problem**)**Problem****Sliding Window**(Related**:**)**Problem****Logical Operators:****CPP Set 1****,****Set 2****,****Java****,****Python****Bit Manipulation:****Set 1****,****Set 2****,**(Related Problems:**Set 3****Problem 1****,****Problem 2****,**)**Problem 3****Bitset CPP****Top 50 Array Coding Problems for Interviews****Top 50 String Coding Problems for Interviews**

**Number Theory and Combinatorics**

**Number Theory and Combinatorics**

(Related**Prime Number**)**Problem**(Related**Sieve of Eratosthenes**)**Problem**(Related**Segmented Sieve**)**Problem**(Related**Find all divisors of a natural number**)**Problem**(Related**Least prime factor of numbers upto N**)**Problem**(Related**All prime factors of a number**)**Problem****Prime Factorization using Sieve O(log n) for multiple queries**(Related**Sum of all factors of a number**)**Problem****Gcd of Two numbers****,**(Related**Lcm of two numbers**)**Problem****Linear Diophantine Equations****Euclidean algorithms (Basic and Extended)**(Related**Eulerâ€™s Totient Function**)**Problem****Eulerâ€™s Totient function for all numbers smaller than or equal to n****Inclusion Exclusion PrincipleÂ****Pigeon Hole Principle****Modular Operations****Modular Inverse**(Related**:****Problem 1****,**)**Problem 2****Chinese Remainder Theorem:****Set 1****,****Set 2****Power(x, y) in O( logN )****Power(x, y) % mod**(Related**:****Problem 1****,**)**Problem 2****Matrix Exponentiation**(Related**:**)**Problem****Permutation and Combination:****Set 1****,****Set 2****,****Quiz 1****,****Quiz 2****nCr:****Set 1****,****Set 2****nCr % mod:****Set1****,****Set 2**(Related**:**)**Problem****nCr % mod for multiple queries**(Related**:**)**Problem****Catalan numbers****:**and Related**Applications****Problem****Gaussian Elimination**

**Searching, Sorting and Basic Data Structures**

**Searching, Sorting and Basic Data Structures**

(Related Problems:**Linear Search****Problem 1****,**)**Problem 2****Binary Search****,**(Related Problems :**Unbounded Binary Search****Â****Problem 1****,****Problem 2****,**)**Problem 3****Inbuilt sorting O(logN):****CPP****,****Java****,**(Related Problems:**Python****Problem 1****,****Problem 2****,****Problem 3****,**)**Problem 4**(Related Problems:**Merge Sort****Problem 1,**)**Problem 2**(Related Problems:**Quick Sort**)**Problem**Implementation in**Stack:****CPP****,****Java****,**(Related Problems:**Python****Problem 1****,****Problem 2****,**)**Problem 3**Implementation in**Queue:****CPP****,****Java****,**(Related Problems:**Python****Problem 1****,****Problem 2****,**)**Problem 3**Implementation in**Deque:****CPP****,****Java****,**(Related Problems:**Python**)**Problem**Implementation in**Priority Queue:****CPP****,****Java****,**(Related Problems:**Python****Problem 1****,****Problem 2****,**)**Problem 3**

**Tree and Graphs**

**Tree and Graphs**

**Tree BFS****,**(Related Problems:**Tree DFS****Problem 1****,****Problem 2****,**)**Problem 3****Graph BFS****,**,**Graph BFS 2**(Related Problems:**Graph DFS****Problem 1****,**)**Problem 2**(Related Problems:**Dijkstraâ€™s Shortest Path Algorithm****Problem 1****,**)**Problem 2**(Related**Bellman â€“ Ford Algorithm**)**Problem**(Related**Floyd Warshall Algorithm**)**Problem****0-1 BFS****,****Dialâ€™s Algorithm****Detect cycle:****Directed****,**(Related Problems:**Undirected****Problem 1****,**)**Problem 2****Disjoint set(union-find):****Set 1****,****Set 2****,**(Related**Set 3**)**Problem****Topological Sorting****,**(Related**Kahnâ€™s Algorithm**)**Problem****Minimum Spanning Tree:****Primâ€™s Algorithm****,**(Related**Kruskal Algorithm**)**Problem****Bipartite or not****,**(Related Problems:**M-Coloring****Problem 1****,****Problem 2****,**)**Problem 3****Strongly Connected Components:****Tarjan****,**(Related Problems:**Kosaraju****Problem 1****,**)**Problem 2****Euler Path:****Undirected****,**(Related**Directed**)**Problem****Flow Algorithms:****Set 1****,****Set 2****,**(Related Problems:**Dinicâ€™s Algorithm****Problem 1****,**)**Problem 2****Diameter of Tree****Centroid Decomposition****Lowest Common Ancestor****Top 50 Tree Coding Problems for Interviews**

**Recursion and Dynamic Programming**

**Recursion and Dynamic Programming**

**Recursion****: Â****Quiz 1****,****Quiz 2****,****Quiz 3****,****Quiz 4****,****Quiz 5****,****Quiz 6****,****Quiz 7**Related Problems:**(****Problem 1****,****Problem 2****,**)**Problem 3****Backtracking**Related Problems:**: (****Problem 1****,****Problem 2****)****Dp Introduction:****Set 1****,****Set 2****,****Set 3****,****Set 4****,****Set 5****Most useful Dynamic Programming questions****Additional DP Problems :****Problem 1****,****Problem 2****,****Problem 3****,****Problem 4****Dp on Trees:****Set 1****,****Set 2****Dp on Bit Masking:****Set 1****,****Set 2****,****Set 3****Digit Dp****Top 50 Dynamic Programming Coding Problems for Interviews**

**String Algorithms**

**String Algorithms**

**Suffix Tree:****Set 1****,****Set 2****Z Algorithm****KMP Algorithm****,**(Related**Rabin-Karp Algorithm**)**Problem****Manacherâ€™s Algorithm:****Set 1****,****Set 2****,****Set 3****,****Set 4****Suffix Automation:****Set 1****,****Set 2**

**Geometry and Game Theory**

**Geometry and Game Theory**

**Closest Pair of Points****How to check if two given line segments intersect?**Related**(**)**Problem****How to check if a given point lies inside or outside a polygon?****Convex Hull:****Set 1****,**(Related**Set 2**)**Problem****Given n line segments, find if any two segments intersect****Check whether a given point lies inside a triangle or not**(Related**How to check if given four points form a square:**)**Problem****Combinatorial Game Theory:****Set 1****,****Set 2****,****Set 3****,****Set 4****Minimax Algorithm in Game Theory:****Set 1****,****Set 2****,****Set 3****,****Set 4****,****Set 5****Variation in Nim Game****Find the winner in nim-game****Optimal Strategy for a Game**

**Advance Data Structures**

**Advance Data Structures**

**Trie:****Set 1****,****Set 2****,****Set 3**Related Problems:**, (****Problem 1****,****Problem 2****,****Problem 3****,****Problem 4****,**)**Problem 5****Fenwick Tree:****Set 1****,****Set 2****,****Set 3****,****Set 4**Related**, (****Problem****)****Segment Tree:****Set 1,****Set 2****,****Set 3**Related**(****Problem****)****Sparse Table:****Set 1****,****Set 2****Sqrt Decomposition:****Set 1****,****Set 2****Heavy Light Decomposition:****Set 1****,****Set 2****Meet in the Middle****MOâ€™s Algorithm****,****Problem****Policy based Data Structure**

You may also check Geeksforgeeks Online Courses to Learn Data Structures and Algorithms, well designed courses taught by Industry Experts.

**GeeksforGeeks Courses**

**GeeksforGeeks Courses**

## Competitive Programming – Live Course

Get ready to take your programming skills to the next level? This

will help you enhance your problem-solving skills to be a programmer for a top company and gain a competitive edge over other candidates in SDE interviews. LearnCompetitive Programming – Live Courseand much more. Then, why wait? Take your first step towards becoming a better programmer, see you in the course!Basics of programming, Data structure and algorithms, Efficient implementation of mathematical algorithms## DSA Self Paced

Master Data Structures and Algorithms, trusted by over 75,000 students! Prepare for the interviews with leading IT giants like Microsoft, Amazon, Adobe, etc. Built with years of experience by top industry experts and gives you a complete package of video lectures, practice problems, quizzes, discussion forums and contests. Learn and master DSA at the most affordable price possible with GeeksforGeeks

. Join Today!DSA Self-Paced Course## Language Foundation Courses[C Programming / C++ / JAVA / Python]

Master any programming language from scratch and understand all its core fundamental concepts for a strong programming foundation at budget-friendly prices with help of GeeksforGeeks Language Foundation Courses â€“

C Programming||Java Foundation|Python Foundation. These courses are for complete beginners who want to get started with programming and build their foundations. Start your coding journey today!.C++ Foundation