Competitive programming coding challenges

Practise competitive programming with 35 coding challenges, from easy to hard. Every challenge runs in your browser with instant tests, an AI review of your code and community solutions to compare.

Easy · 7 Medium · 16 Hard · 12

Skills you'll practise: Big number arithmeticPrimality testingCycle detectionDigit manipulationMemoizationModular arithmeticPair enumeration2D grid traversalArea calculationBase conversionBitmask DPBlock skipping
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
341
Challenges
245
Solutions shared
9
Languages

All challenges

Search by name or topic, or filter by difficulty.

35 challenges
Hard

Shortest Delivery Tour

Visit every city once and return home as cheaply as possible.

You'll learn Bitmask DPTraveling salesman
AdvancedBitmasksCompetitive-programmingDynamic-programming
Hard

Minimum Window Substring

Find the shortest piece of text containing all required characters.

You'll learn Grow and shrink windowsFrequency maps
AdvancedCompetitive-programmingSliding-windowStrings
Medium

K-th Smallest Element

Find the k-th smallest value without fully sorting.

You'll learn QuickselectPartitioning
AdvancedCompetitive-programmingSorting
Hard

Median of Two Sorted Arrays

Find the median of two sorted lists combined.

You'll learn Partition searchO(log n)
AdvancedBinary-searchCompetitive-programming
Hard

Strongly Connected Components

Count groups of nodes that can all reach each other.

You'll learn Graph algorithmsTarjan or Kosaraju
AdvancedCompetitive-programmingGraphs
Hard

Largest Rectangle in a Histogram

Find the largest rectangle that fits under a histogram.

You'll learn Monotonic stackArea calculation
AdvancedCompetitive-programmingStacks
Hard

Trapping Rain Water

Compute how much rain water an elevation map holds.

You'll learn Two pointersPrefix maxima
AdvancedArraysCompetitive-programmingGreedy
Hard

Count Inversions

Count the out-of-order pairs in a list.

You'll learn Merge sortDivide and conquer
AdvancedCompetitive-programmingSorting
Hard

Sliding Window Maximum

Report the maximum of every window of k numbers.

You'll learn Monotonic dequeO(n) windows
AdvancedCompetitive-programmingSliding-window
Hard

Matrix Chain Multiplication

Find the cheapest order to multiply a chain of matrices.

You'll learn Interval DPOptimization
AdvancedCompetitive-programmingDynamic-programming
Medium

Maximum Path Sum in a Triangle

Find the largest sum on a path from the top of a number triangle to its bottom row.

You'll learn Dynamic programmingBottom-up computation
Competitive-programmingDynamic-programmingIntermediateNumber-theoryProject Euler styleTreesmath
No solutions yet
Easy

Smallest Multiple

Find the smallest positive number that every integer in a range divides evenly.

You'll learn Greatest common divisorLeast common multiple
BeginnerCompetitive-programmingConditionsFinanceFunctionsNumber-theoryProject Euler stylemath
No solutions yet
Medium

Largest Product in a Grid

Find the largest product of k numbers in a straight line in a grid.

You'll learn 2D grid traversalDirection vectors
Competitive-programmingDynamic-programmingGridsIntermediateMatricesNumber-theoryProject Euler stylemath
No solutions yet
Easy

Self Powers Tail

Find the last k digits of 1^1 + 2^2 + ... + n^n.

You'll learn Modular arithmeticFast exponentiation
BeginnerBig integersCompetitive-programmingNumber-theoryProject Euler stylemath
No solutions yet
Hard

Longest Recurring Cycle

Find the d up to a limit whose fraction 1/d has the longest repeating decimal block.

You'll learn Long divisionCycle detection
AdvancedCompetitive-programmingDFSNumber-theoryProject Euler stylemath
No solutions yet
Easy

First Fibonacci With N Digits

Find the position of the first Fibonacci number that has n digits.

You'll learn Big number arithmeticSequences
BeginnerBig integersCompetitive-programmingNumber-theoryProject Euler stylemath
No solutions yet
Easy

Distinct Powers

Count the different values of a to the power b for a and b in a range.

You'll learn Perfect powersSets
BeginnerCompetitive-programmingNumber-theoryProject Euler stylemath
No solutions yet
Easy

Factorial Digit Sum

Add up the decimal digits of n factorial.

You'll learn Big number arithmeticDigit manipulation
BeginnerBig integersCompetitive-programmingNumber-theoryProject Euler stylemath
No solutions yet