Arrays
Pointers, windows and in-place tricks, drawn out step by step.
Arrays progress0 / 14
- Array BasicsOne block of memory, instant access to any slot.4m
- Two PointersTwo indexes closing in beat one loop nesting another.5m
- Sliding WindowReuse the last answer instead of recomputing it.5m
- Prefix SumsPay once up front, answer range queries instantly.5m
- In-Place ReversalFlip an array with one temp variable, not a copy.4m
- Move ZeroesPush the junk to the back without losing the order.5m
- Container With Most WaterThe shorter wall decides. So move the shorter wall.6m
- Kadane's AlgorithmDrop the past the moment it starts costing you.6m
- Cyclic SortWhen values are 1..n, every value already knows its index.5m
- Merge Sorted ArraysFill from the back and you never overwrite unread data.5m
- Dutch National FlagThree values, three regions, one pass.5m
- Product Except SelfTwo sweeps beat one division.5m
- Rotate an ArrayThree reversals move every element home.4m
- Majority ElementCancel the votes in pairs and the majority survives.5m
Quiz yourself: 3 questions from this module
1 / 3