Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” The Collection Toolkit

โญโญ intermediateโณ 24 min read๐Ÿ“ Lesson 106 of 265

Frequency maps, dedup, queue processing, and an LRU-shaped eviction cache in one graded unit.

The gate (mini-build)

Four tools in one graded unit:

  1. Frequency(string text) โ†’ IReadOnlyDictionary<string, int> counting lowercase whitespace-separated words.
  2. FirstUnique(string text) โ†’ the first word (lowercased) with count 1, or null.
  3. ProcessOrders(IEnumerable<string> commands) โ€” "push X" enqueues, "pop" dequeues; returns the join of popped values in order (empty string when nothing popped). FIFO, not LIFO.
  4. EvictCache โ€” a tiny cache with Put(k, v) and Get(k): capacity 3; Put on a full cache evicts the least-recently-used-or-updated key; Get refreshes recency; Get miss returns -1.

Tool 4 is the composition lesson: Dictionary + recency tracking, graded behaviorally.