Module 16 ¡ Map, Set, WeakMap, Iterators, Generators and Regular Expressions
The Contest and Interview Pack: Four Patterns, Six Questions and a Gallery of Collection and Regex Bugs
ProReading
Contest problems and interviews keep coming back to the same handful of ideas. "Count how often each thing appears" is a Map. "Have I seen this already?" is a Set. "Which items share a property?" is a Map of Sets. "Find the first arrangement that works" is a generator you stop early. Each pattern below comes with a solved problem, small enough to type during a contest.
Checking what this lesson needs for youâĻ
What is inside The Contest and Interview Pack: Four Patterns, Six Questions and a Gallery of Collection and Regex Bugs
- Pattern 1: counting with a Map
- Pattern 2: seen-before with a Set
- Pattern 3: a Map of Sets as an index
- Pattern 4: a lazy generator search
- Escaping text before it becomes a regex
- Six interview questions