Skip to content

Foundations -> STL Basics

Container and algorithm fluency: build the habit of reaching for vector, set, map, iterators, and standard algorithms before writing custom machinery.

  • Topic slug: foundations/stl
  • Tutorial page: Open tutorial
  • Ladder page: Open ladder
  • Repo problems currently tagged here: 1
  • Repo companion pages: 0
  • Curated external problems: 8

Microtopics

  • vector
  • pair-and-tuple
  • iterators
  • sort
  • lower_bound
  • set-and-multiset
  • map
  • priority_queue

Learning Sources

Source Type
cppreference containers Primary
cppreference algorithms Primary
USACO Guide Reference

Practice Sources

Source Type
CSES Problem Set Practice
Codeforces data structures tag Practice

Curated External Problems

Warm-Up

Problem Source Difficulty Context Style Prerequisites Tags Why it fits
Distinct Numbers CSES Easy - Data-Structure-Heavy; Implementation-Heavy Arrays; Sets; Hashing Basics Set; Deduplication; Frequency; Sort; Unique A straightforward entry point for seeing why a set or hash set is useful.

Core

Problem Source Difficulty Context Style Prerequisites Tags Why it fits
Restaurant Customers CSES Easy - Modeling-Heavy; Implementation-Heavy Sorting; Event Processing; Prefix Counts Events; Sweep Line; Sorting Useful for learning to model arrivals and departures as events and process them cleanly.
Towers CSES Medium - - - Multiset; Lower Bound; Patience Teaches the lower_bound pattern on a multiset.

Classics

Problem Source Difficulty Context Style Prerequisites Tags Why it fits
Concert Tickets CSES Medium - Data-Structure-Heavy; Greedy-Heavy Sorting; Ordered Multiset Ideas; Greedy Matching Multiset; Lower Bound A canonical ordered-container problem that rewards knowing lower_bound-style queries.
Room Allocation CSES Medium - Data-Structure-Heavy; Greedy-Heavy Sorting; Priority Queues; Interval Scheduling Priority-Queue; Intervals; Assignment A strong multiset/priority-queue assignment problem that feels very STL-native.
Traffic Lights CSES Medium - Data-Structure-Heavy Ordered Sets; Interval Reasoning; Sorting Ordered-Set; Intervals; Updates; Neighbors A classic ordered-set exercise with dynamic insertions and interval maintenance.

Advanced

Problem Source Difficulty Context Style Prerequisites Tags Why it fits
Sliding Window Cost CSES Hard - Data-Structure-Heavy Multisets; Two Pointers; Median Reasoning Median; Sliding-Window; Absolute-Deviation A deeper ordered-container problem that pairs median maintenance with cost accounting.
Sliding Window Median CSES Hard - Data-Structure-Heavy; Query-Heavy Multisets; Two Pointers; Balanced Data Structures Multiset; Median; Sliding-Window A demanding but standard STL benchmark for maintaining order statistics over a moving window.

Repo Problems

Code Title Fit Difficulty Pattern Note Solution
DISTINCTNUMBERS Distinct Numbers primary easy sort unique; container deduplication; stl algorithms Note Code

Regeneration

python3 scripts/generate_problem_catalog.py