← Quit0 / 0 correct
You need a FIFO queue with O(1) push to the back and pop from the front. Which std collection fits?
VecDeque ring buffer ┌──┬──┬──┬──┬──┬──┐ │d │ │ │a │b │c │ └──┴──┴──┴──┴──┴──┘ ▲tail ▲head
You need a FIFO queue with O(1) push to the back and pop from the front. Which std collection fits?
VecDeque ring buffer ┌──┬──┬──┬──┬──┬──┐ │d │ │ │a │b │c │ └──┴──┴──┴──┴──┴──┘ ▲tail ▲head