Cutting In, and Keeping Only the Last 100: Deques and Ring Buffers
A paid mobile order jumps to the front of the line, a customer at the back gives up and leaves, and a log must keep only its last 100 lines out of a million. Find the line that's cheap at both ends, and the fixed circle of slots that never moves or grows.
Updated

- Category
- Data Structures
- Level
- Journeyman
- Tags
- data structures, Deque (data-structures), Modulo (software-development), Queue (data-structures), Ring Buffer