๐ 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:
Frequency(string text)โIReadOnlyDictionary<string, int>counting lowercase whitespace-separated words.FirstUnique(string text)โ the first word (lowercased) with count 1, or null.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.EvictCacheโ a tiny cache withPut(k, v)andGet(k): capacity 3;Puton a full cache evicts the least-recently-used-or-updated key;Getrefreshes recency;Getmiss returns -1.
Tool 4 is the composition lesson: Dictionary + recency tracking, graded behaviorally.