Dsa
Queue
Warm-up
Queue Peek Functionality
Implement a simple queue that allows users to enqueue integers and view the front element without removing it, known as 'peek'. Read the number of elements to enqueue, then the integers, and finally output the element at the front of the queue, or indicate if the queue is empty.
Example:
Input:
4
5
10
15
20
peek
Output:
5
Key concepts
queuepeekbasic operations
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now