Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • DSA
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps
    • Software and Tools
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Go Premium
  • DSA Tutorial
  • Data Structures
  • Algorithms
  • Array
  • Strings
  • Linked List
  • Stack
  • Queue
  • Tree
  • Graph
  • Searching
  • Sorting
  • Recursion
  • Dynamic Programming
  • Binary Tree
  • Binary Search Tree
  • Heap
  • Hashing
  • Divide & Conquer
  • Mathematical
  • Geometric
  • Bitwise
  • Greedy
  • Backtracking
  • Branch and Bound
  • Matrix
  • Pattern Searching
  • Randomized
Open In App

Competitive Programming - A Complete Guide

Last Updated : 22 Aug, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

Why To Do Competitive Programming?

Here are some reasons about why you should start Competitive Programming:

  • Mental Agility and Quick Thinking: 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.
  • Career Prospect: 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 Google, ServiceNow, Atlassian, etc. have technical interviews based on competitive programming problems.
  • Learning Opportunity: In Competitive programming, we get a wide range of variety of problems and various arithmetic concepts. Competitive programming exposes various data structures and algorithms which help us better understand the complexity of problems.

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

  • Reverse an array(Related Problems: Problem 1, Problem 2)
  • Sum of Digits
  • Program to Check if a Given String is Palindrome in C, Python (Related Problem)
  • Sum of array elements(Related Problem)
  • Maximum and Minimum element of array(Related Problem)
  • Counting frequencies of array elements(Related Problems: 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)
  • Activity Selection Problem: (Related Problem)
  • Job Sequencing Problem: (Related Problem)
  • Sliding Window: (Related Problem)
  • Logical Operators: CPP Set 1, Set 2, Java, Python
  • Bit Manipulation: Set 1, Set 2, Set 3(Related Problems: 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

  • Prime Number(Related Problem)
  • Sieve of Eratosthenes(Related Problem)
  • Segmented Sieve (Related Problem)
  • Find all divisors of a natural number (Related Problem)
  • Least prime factor of numbers upto N (Related Problem)
  • All prime factors of a number(Related Problem)
  • Prime Factorization using Sieve O(log n) for multiple queries
  • Sum of all factors of a number(Related Problem)
  • Gcd of Two numbers, Lcm of two numbers(Related Problem)
  • Linear Diophantine Equations
  • Euclidean algorithms (Basic and Extended)
  • Euler’s Totient Function(Related 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: Applications and Related Problem
  • Gaussian Elimination

Searching, Sorting and Basic Data Structures

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

Tree and Graphs

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

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

  • Suffix Tree: Set 1, Set 2
  • Z Algorithm
  • KMP Algorithm, Rabin-Karp Algorithm(Related Problem)
  • Manacher’s Algorithm: Set 1, Set 2, Set 3, Set 4
  • Suffix Automation: Set 1, Set 2

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, Set 2(Related Problem)
  • Given n line segments, find if any two segments intersect
  • Check whether a given point lies inside a triangle or not
  • How to check if given four points form a square: (Related 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

  • 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.


K

kartik
Improve
Article Tags :
  • DSA

Similar Reads

    Basics & Prerequisites

    Logic Building Problems
    Logic building is about creating clear, step-by-step methods to solve problems using simple rules and principles. It’s the heart of coding, enabling programmers to think, reason, and arrive at smart solutions just like we do.Here are some tips for improving your programming logic: Understand the pro
    2 min read
    Analysis of Algorithms
    Analysis of Algorithms is a fundamental aspect of computer science that involves evaluating performance of algorithms and programs. Efficiency is measured in terms of time and space.BasicsWhy is Analysis Important?Order of GrowthAsymptotic Analysis Worst, Average and Best Cases Asymptotic NotationsB
    1 min read

    Data Structures

    Array Data Structure
    In this article, we introduce array, implementation in different popular languages, its basic operations and commonly seen problems / interview questions. An array stores items (in case of C/C++ and Java Primitive Arrays) or their references (in case of Python, JS, Java Non-Primitive) at contiguous
    3 min read
    String in Data Structure
    A string is a sequence of characters. The following facts make string an interesting data structure.Small set of elements. Unlike normal array, strings typically have smaller set of items. For example, lowercase English alphabet has only 26 characters. ASCII has only 256 characters.Strings are immut
    2 min read
    Hashing in Data Structure
    Hashing is a technique used in data structures that efficiently stores and retrieves data in a way that allows for quick access. Hashing involves mapping data to a specific index in a hash table (an array of items) using a hash function. It enables fast retrieval of information based on its key. The
    2 min read
    Linked List Data Structure
    A linked list is a fundamental data structure in computer science. It mainly allows efficient insertion and deletion operations compared to arrays. Like arrays, it is also used to implement other data structures like stack, queue and deque. Here’s the comparison of Linked List vs Arrays Linked List:
    2 min read
    Stack Data Structure
    A Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first
    2 min read
    Queue Data Structure
    A Queue Data Structure is a fundamental concept in computer science used for storing and managing data in a specific order. It follows the principle of "First in, First out" (FIFO), where the first element added to the queue is the first one to be removed. It is used as a buffer in computer systems
    2 min read
    Tree Data Structure
    Tree Data Structure is a non-linear data structure in which a collection of elements known as nodes are connected to each other via edges such that there exists exactly one path between any two nodes. Types of TreeBinary Tree : Every node has at most two childrenTernary Tree : Every node has at most
    4 min read
    Graph Data Structure
    Graph Data Structure is a collection of nodes connected by edges. It's used to represent relationships between different entities. If you are looking for topic-wise list of problems on different topics like DFS, BFS, Topological Sort, Shortest Path, etc., please refer to Graph Algorithms. Basics of
    3 min read
    Trie Data Structure
    The Trie data structure is a tree-like structure used for storing a dynamic set of strings. It allows for efficient retrieval and storage of keys, making it highly effective in handling large datasets. Trie supports operations such as insertion, search, deletion of keys, and prefix searches. In this
    15+ min read

    Algorithms

    Searching Algorithms
    Searching algorithms are essential tools in computer science used to locate specific items within a collection of data. In this tutorial, we are mainly going to focus upon searching in an array. When we search an item in an array, there are two most common algorithms used based on the type of input
    2 min read
    Sorting Algorithms
    A Sorting Algorithm is used to rearrange a given array or list of elements in an order. For example, a given array [10, 20, 5, 2] becomes [2, 5, 10, 20] after sorting in increasing order and becomes [20, 10, 5, 2] after sorting in decreasing order. There exist different sorting algorithms for differ
    3 min read
    Introduction to Recursion
    The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function. A recursive algorithm takes one step toward solution and then recursively call itself to further move. The algorithm stops once we reach the solution
    14 min read
    Greedy Algorithms
    Greedy algorithms are a class of algorithms that make locally optimal choices at each step with the hope of finding a global optimum solution. At every step of the algorithm, we make a choice that looks the best at the moment. To make the choice, we sometimes sort the array so that we can always get
    3 min read
    Graph Algorithms
    Graph is a non-linear data structure like tree data structure. The limitation of tree is, it can only represent hierarchical data. For situations where nodes or vertices are randomly connected with each other other, we use Graph. Example situations where we use graph data structure are, a social net
    3 min read
    Dynamic Programming or DP
    Dynamic Programming is an algorithmic technique with the following properties.It is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for the same inputs, we can optimize it using Dynamic Programming. The idea is to simply store the results of
    3 min read
    Bitwise Algorithms
    Bitwise algorithms in Data Structures and Algorithms (DSA) involve manipulating individual bits of binary representations of numbers to perform operations efficiently. These algorithms utilize bitwise operators like AND, OR, XOR, NOT, Left Shift, and Right Shift.BasicsIntroduction to Bitwise Algorit
    4 min read

    Advanced

    Segment Tree
    Segment Tree is a data structure that allows efficient querying and updating of intervals or segments of an array. It is particularly useful for problems involving range queries, such as finding the sum, minimum, maximum, or any other operation over a specific range of elements in an array. The tree
    3 min read
    Pattern Searching
    Pattern searching algorithms are essential tools in computer science and data processing. These algorithms are designed to efficiently find a particular pattern within a larger set of data. Patten SearchingImportant Pattern Searching Algorithms:Naive String Matching : A Simple Algorithm that works i
    2 min read
    Geometry
    Geometry is a branch of mathematics that studies the properties, measurements, and relationships of points, lines, angles, surfaces, and solids. From basic lines and angles to complex structures, it helps us understand the world around us.Geometry for Students and BeginnersThis section covers key br
    2 min read

    Interview Preparation

    Interview Corner: All Resources To Crack Any Tech Interview
    This article serves as your one-stop guide to interview preparation, designed to help you succeed across different experience levels and company expectations. Here is what you should expect in a Tech Interview, please remember the following points:Tech Interview Preparation does not have any fixed s
    3 min read
    GfG160 - 160 Days of Problem Solving
    Are you preparing for technical interviews and would like to be well-structured to improve your problem-solving skills? Well, we have good news for you! GeeksforGeeks proudly presents GfG160, a 160-day coding challenge starting on 15th November 2024. In this event, we will provide daily coding probl
    3 min read

    Practice Problem

    GeeksforGeeks Practice - Leading Online Coding Platform
    GeeksforGeeks Practice is an online coding platform designed to help developers and students practice coding online and sharpen their programming skills with the following features. GfG 160: This consists of most popular interview problems organized topic wise and difficulty with with well written e
    6 min read
    Problem of The Day - Develop the Habit of Coding
    Do you find it difficult to develop a habit of Coding? If yes, then we have a most effective solution for you - all you geeks need to do is solve one programming problem each day without any break, and BOOM, the results will surprise you! Let us tell you how:Suppose you commit to improve yourself an
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • DSA Tutorial
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences