Module 7 · Arrays and the Array Methods: The map, filter, reduce Pipeline
The Contest and Interview Pack: Two-Sum, Sliding Windows, Prefix Sums, Flatten and Chunk
ProReading
Contest problems and interview questions about arrays repeat a small set of ideas. The first idea that comes to mind is usually right but slow: try every pair, or recompute every window. With n at a hundred thousand, "every pair" is five billion steps, and the judge stops you at two seconds.
Checking what this lesson needs for you…
What is inside The Contest and Interview Pack: Two-Sum, Sliding Windows, Prefix Sums, Flatten and Chunk
- Pattern 1: two-sum with a Map
- Pattern 2: the sliding window
- Pattern 3: prefix sums
- Pattern 4: flatten without flat
- Pattern 5: chunking
- Six interview questions