Competitive Programming exercises with solutions

42 practice problems from the 14 lessons of the Competitive Programming course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

14 easy problems 14 medium problems 14 hard problems

Contests, judges and time limits

3 problems · Read the lesson

The STL toolbox for contests

3 problems · Read the lesson

Prefix sums

3 problems · Read the lesson

Difference arrays

3 problems · Read the lesson

Two pointers and sliding windows

3 problems · Read the lesson

Binary search on the answer

3 problems · Read the lesson

Sorting first, then greedy

3 problems · Read the lesson

Dynamic programming in contests

3 problems · Read the lesson

Math for contests

3 problems · Read the lesson

Bit tricks and subset masks

3 problems · Read the lesson

Graphs with the STL

3 problems · Read the lesson

Depth-first search and components

3 problems · Read the lesson

Shortest paths: Dijkstra and Floyd

3 problems · Read the lesson

Union-find and spanning trees

3 problems · Read the lesson