Competitive Programmer's Handbook

by Antti Laaksonen · Draft, Jan 2018 Edition · 2018

A free, comprehensive guide to competitive programming covering all major algorithms and data structures with clear explanations and CSES Practice problems.

220Extracted Problems
30Chapters
0Linked to DB
220Book Total
CompetitiveFreeCSESAlgorithmsMathematics
220 shown
  • E1.1CSES — Weird Algorithm
    Simulation
    Easy
    E1.2CSES — Missing Number
    Math
    Easy
    E1.3CSES — Repetitions
    Strings
    Easy
    E1.4CSES — Increasing Array
    Greedy
    Easy
    E1.5CSES — Permutations
    Construction
    Easy
    1-6Problem 1.6
    Easy
    1-7Problem 1.7
    Easy
  • E2.1CSES — Apple Division
    BruteForce
    Easy
    E2.2CSES — Chessboard and Queens
    Backtracking
    Medium
    E2.3CSES — Bit Strings
    MathModular
    Easy
    E2.4CSES — Trailing Zeros
    Math
    Easy
    E2.5CSES — Coin Piles
    Math
    Easy
    2-6Problem 2.6
    Easy
    2-7Problem 2.7
    Easy
  • E3.1CSES — Apartments
    SortingGreedy
    Easy
    E3.2CSES — Ferris Wheel
    SortingTwoPointers
    Easy
    E3.3CSES — Concert Tickets
    SortingBinarySearch
    Medium
    E3.4CSES — Restaurant Customers
    SortingSweepLine
    Medium
    E3.5CSES — Movie Festival
    SortingGreedy
    Easy
    E3.6CSES — Sum of Two Values
    TwoPointersHash
    Easy
    3-7Problem 3.7
    Easy
  • E4.1CSES — Distinct Numbers
    Set
    Easy
    E4.2CSES — Collecting Numbers
    Set
    Easy
    E4.3CSES — Collecting Numbers II
    SetSimulation
    Medium
    E4.4CSES — Playlist
    SlidingWindowSet
    Easy
    E4.5CSES — Towers
    GreedyMultiSet
    Easy
    E4.6CSES — Traffic Lights
    SetBinarySearch
    Medium
    E4.7CSES — Josephus I
    Simulation
    Easy
    E4.8CSES — Josephus II
    SetOrderedSet
    Medium
  • E5.1CSES — Increasing Subsequence
    BinarySearchDP
    Easy
    E5.2CSES — Two Knights
    MathCounting
    Medium
    E5.3CSES — Grid Paths
    BacktrackingPruning
    Medium
    5-4Problem 5.4
    Medium
    5-5Problem 5.5
    Hard
    5-6Problem 5.6
    Easy
    5-7Problem 5.7
    Easy
  • E6.1CSES — Coin Problem
    Greedy
    Easy
    E6.2CSES — Stick Lengths
    GreedyMath
    Medium
    E6.3CSES — Polygon Lattice Points
    GreedyMath
    Medium
    E6.4CSES — Missing Coin Sum
    GreedySorting
    Easy
    E6.5CSES — Collecting Numbers II
    Greedy
    Medium
    E6.6CSES — Tasks and Deadlines
    GreedyScheduling
    Medium
    6-7Problem 6.7
    Easy
  • E7.1CSES — Dice Combinations
    DP
    Easy
    E7.2CSES — Minimizing Coins
    DPKnapsack
    Easy
    E7.3CSES — Coin Combinations I
    DPCounting
    Easy
    E7.4CSES — Coin Combinations II
    DPCounting
    Easy
    E7.5CSES — Removing Digits
    DPGreedy
    Easy
    E7.6CSES — Grid Paths
    DPGrid
    Medium
    E7.7CSES — Book Shop
    DPKnapsack
    Medium
    E7.8CSES — Array Description
    DP
    Medium
    E7.9CSES — Coin Problem (Path)
    DP
    Medium
    E7.10CSES — Edit Distance
    DPStrings
    Medium
    E7.11CSES — Rectangle Cutting
    DPIntervalDP
    Medium
    E7.12CSES — Money Sums
    DPKnapsack
    Medium
    E7.13CSES — Removal Game
    DPGameTheory
    Hard
    E7.14CSES — Two Sets II
    DPCounting
    Hard
  • E8.1CSES — Sliding Median
    SlidingWindowHeap
    Hard
    E8.2CSES — Sliding Cost
    SlidingWindowHeap
    Hard
    E8.3CSES — Range Queries and Copies
    PersistentSegTree
    Hard
    8-4Problem 8.4
    Medium
    8-5Problem 8.5
    Hard
    8-6Problem 8.6
    Easy
    8-7Problem 8.7
    Easy
  • E9.1CSES — Static Range Sum Queries
    PrefixSum
    Easy
    E9.2CSES — Static Range Minimum Queries
    SparseTable
    Easy
    E9.3CSES — Dynamic Range Sum Queries
    FenwickTree
    Easy
    E9.4CSES — Dynamic Range Minimum Queries
    SegTree
    Medium
    E9.5CSES — Range Xor Queries
    PrefixSumBit
    Easy
    E9.6CSES — Range Update Queries
    FenwickTreeDiffArray
    Medium
    E9.7CSES — Forest Queries
    PrefixSum2D
    Medium
    E9.8CSES — Hotel Queries
    SegTreeBinarySearch
    Medium
  • E10.1CSES — Flag Arrangements
    BitmaskDP
    Medium
    E10.2CSES — Counting Tilings
    BitmaskDPProfileDP
    Hard
    E10.3CSES — Counting Numbers
    DigitDP
    Hard
    10-4Problem 10.4
    Medium
    10-5Problem 10.5
    Hard
    10-6Problem 10.6
    Easy
    10-7Problem 10.7
    Easy
  • E11.1CSES — Counting Rooms
    DFSGrid
    Easy
    E11.2CSES — Labyrinth
    BFSGrid
    Easy
    E11.3CSES — Building Roads
    BFSUnionFind
    Easy
    E11.4CSES — Message Route
    BFS
    Easy
    E11.5CSES — Building Teams
    BFSBipartite
    Easy
    E11.6CSES — Round Trip
    DFSCycle
    Medium
    E11.7CSES — Monsters
    BFSMultiSource
    Medium
  • E12.1CSES — Course Schedule
    TopSortDAG
    Easy
    E12.2CSES — Longest Flight Route
    DAGDP
    Medium
    E12.3CSES — Game Routes
    DAGDP
    Medium
    E12.4CSES — Investigation
    DijkstraDAG
    Hard
    E12.5CSES — Planets Queries I
    FunctionalGraphBinaryLifting
    Medium
    E12.6CSES — Planets Queries II
    FunctionalGraphSCC
    Hard
    12-7Problem 12.7
    Easy
  • E13.1CSES — Shortest Routes I
    Dijkstra
    Easy
    E13.2CSES — Shortest Routes II
    FloydWarshall
    Easy
    E13.3CSES — High Score
    BellmanFordNegCycle
    Medium
    E13.4CSES — Flight Discount
    DijkstraDP
    Medium
    E13.5CSES — Cycle Finding
    BellmanFordNegCycle
    Medium
    E13.6CSES — Flight Routes
    KShortestPaths
    Hard
    E13.7CSES — Round Trip II
    DijkstraCycle
    Hard
  • E14.1CSES — Subordinates
    TreeDFS
    Easy
    E14.2CSES — Tree Matching
    TreeDP
    Medium
    E14.3CSES — Tree Diameter
    TreeBFS
    Easy
    E14.4CSES — Tree Distances I
    TreeReRooting
    Medium
    E14.5CSES — Tree Distances II
    TreeReRooting
    Hard
    E14.6CSES — Company Queries I
    LCABinaryLifting
    Medium
    E14.7CSES — Company Queries II
    LCA
    Hard
    E14.8CSES — Distance Queries
    LCATree
    Hard
  • E15.1CSES — Road Reparation
    MSTKruskal
    Easy
    E15.2CSES — Road Construction
    UnionFindMST
    Medium
    15-3Problem 15.3
    Medium
    15-4Problem 15.4
    Medium
    15-5Problem 15.5
    Hard
    15-6Problem 15.6
    Easy
    15-7Problem 15.7
    Easy
  • E16.1CSES — Planets and Kingdoms
    SCCKosaraju
    Medium
    E16.2CSES — Giant Pizza
    TwoSATSCC
    Hard
    E16.3CSES — Coin Collector
    SCCDAG
    Hard
    E16.4CSES — Mail Delivery
    EulerPathGraph
    Hard
    E16.5CSES — Teleporters Path
    EulerPathDAG
    Hard
    16-6Problem 16.6
    Easy
    16-7Problem 16.7
    Easy
  • E17.1CSES — Distinct Routes
    MaxFlowBFS
    Hard
    E17.2CSES — School Dance
    BipartiteMatching
    Hard
    E17.3CSES — Forbidden Cities
    DijkstraBipartite
    Hard
    17-4Problem 17.4
    Medium
    17-5Problem 17.5
    Hard
    17-6Problem 17.6
    Easy
    17-7Problem 17.7
    Easy
  • E18.1CSES — Path Queries
    HLDSegTree
    Hard
    E18.2CSES — Path Queries II
    HLDSegTree
    Hard
    E18.3CSES — Distinct Colors
    DFSSmallToLarge
    Hard
    E18.4CSES — Finding a Centroid
    TreeCentroid
    Medium
    18-5Problem 18.5
    Hard
    18-6Problem 18.6
    Easy
    18-7Problem 18.7
    Easy
  • E19.1CSES — Eulerian Path
    EulerPathGraph
    Medium
    E19.2CSES — Hamiltonian Flights
    BitmaskDPHamiltonian
    Hard
    E19.3CSES — Knight's Tour
    BacktrackingWarnsdorff
    Hard
    19-4Problem 19.4
    Medium
    19-5Problem 19.5
    Hard
    19-6Problem 19.6
    Easy
    19-7Problem 19.7
    Easy
  • E20.1CSES — Download Speed
    MaxFlow
    Medium
    E20.2CSES — Police Chase
    MinCutMaxFlow
    Medium
    E20.3CSES — School Dance
    BipartiteMatching
    Hard
    E20.4CSES — Distinct Routes
    EdgeDisjointPaths
    Hard
    20-5Problem 20.5
    Hard
    20-6Problem 20.6
    Easy
    20-7Problem 20.7
    Easy
  • E21.1CSES — Counting Divisors
    MathSieve
    Easy
    E21.2CSES — Common Divisors
    MathGCD
    Easy
    E21.3CSES — Sum of Divisors
    MathNumberTheory
    Medium
    E21.4CSES — Divisor Analysis
    MathPrimeFactorization
    Medium
    E21.5CSES — Prime Multiples
    MathInclusionExclusion
    Medium
    E21.6CSES — Counting Coprime Pairs
    MathMobius
    Hard
    21-7Problem 21.7
    Easy
  • E22.1CSES — Counting Necklaces
    CombinatoricsBurnside
    Hard
    E22.2CSES — Counting Grids
    CombinatoricsBurnside
    Hard
    E22.3CSES — Binomial Coefficients
    MathModularArithmetic
    Easy
    E22.4CSES — Creating Strings II
    CombinatoricsMath
    Medium
    E22.5CSES — Distributing Apples
    CombinatoricsStars&Bars
    Medium
    E22.6CSES — Christmas Party
    CombinatoricsDerangement
    Medium
    22-7Problem 22.7
    Easy
  • E23.1CSES — Fibonacci
    MatrixExp
    Easy
    E23.2CSES — Counting Paths
    MatrixExpGraph
    Medium
    E23.3CSES — Ermitteln Fibonacci Numbers
    MatrixExpNumberTheory
    Medium
    23-4Problem 23.4
    Medium
    23-5Problem 23.5
    Hard
    23-6Problem 23.6
    Easy
    23-7Problem 23.7
    Easy
  • E24.1CSES — Dice Probability
    ProbabilityDP
    Easy
    E24.2CSES — Moving Robots
    ProbabilityDP
    Hard
    E24.3CSES — Candies
    ProbabilityDP
    Hard
    E24.4CSES — Sightseeing
    ProbabilityDijkstra
    Hard
    24-5Problem 24.5
    Hard
    24-6Problem 24.6
    Easy
    24-7Problem 24.7
    Easy
  • E25.1CSES — Nim Game I
    GameTheoryNim
    Easy
    E25.2CSES — Nim Game II
    GameTheoryGrundy
    Medium
    E25.3CSES — Staircase Nim
    GameTheoryNim
    Medium
    E25.4CSES — Grundy's Game
    GameTheoryMemoization
    Hard
    E25.5CSES — Another Game
    GameTheoryGrundy
    Hard
    25-6Problem 25.6
    Easy
    25-7Problem 25.7
    Easy
  • E26.1CSES — Word Combinations
    StringsDP
    Medium
    E26.2CSES — String Matching
    StringsKMP
    Easy
    E26.3CSES — Finding Borders
    StringsKMP
    Medium
    E26.4CSES — Finding Periods
    StringsKMP
    Medium
    E26.5CSES — Minimal Rotation
    StringsBooth
    Hard
    E26.6CSES — Longest Palindrome
    StringsManacher
    Medium
    E26.7CSES — Palindrome Queries
    StringsHashing
    Hard
  • E27.1CSES — Increasing Array II
    MoSqrtDecomp
    Hard
    E27.2CSES — List Removals
    SqrtDecompOrderedSet
    Hard
    E27.3CSES — Salary Queries
    MoFenwickTree
    Hard
    27-4Problem 27.4
    Medium
    27-5Problem 27.5
    Hard
    27-6Problem 27.6
    Easy
    27-7Problem 27.7
    Easy
  • E28.1CSES — Range Queries and Copies
    PersistentSegTree
    Hard
    E28.2CSES — New Road Queries
    SegTreeLCA
    Hard
    E28.3CSES — Dynamic Range Queries
    MergeSortTree
    Hard
    28-4Problem 28.4
    Medium
    28-5Problem 28.5
    Hard
    28-6Problem 28.6
    Easy
    28-7Problem 28.7
    Easy
  • E29.1CSES — Point Location Test
    GeometryCrossProduct
    Easy
    E29.2CSES — Line Segment Intersection
    GeometrySegments
    Medium
    E29.3CSES — Polygon Area
    GeometryShoelace
    Easy
    E29.4CSES — Point in Polygon
    GeometryRayCasting
    Medium
    E29.5CSES — Minimum Euclidean Distance
    GeometryClosestPair
    Hard
    E29.6CSES — Convex Hull
    GeometryConvexHull
    Medium
    29-7Problem 29.7
    Easy
  • E30.1CSES — Tasks and Deadlines
    SweepLineGreedy
    Medium
    E30.2CSES — Concert Tickets
    SweepLineBinarySearch
    Medium
    E30.3CSES — Sum of Three Values
    SweepLineTwoPointers
    Medium
    30-4Problem 30.4
    Medium
    30-5Problem 30.5
    Hard
    30-6Problem 30.6
    Easy
    30-7Problem 30.7
    Easy