020-004-010

Queue Basic Operations

Easy

Problem Description

Queue Basic Operations

In this problem: You will use LinkedList as a Queue interface and perform basic operations with offer/poll/peek.

Learning Objective: Understand basic Queue (FIFO: First In, First Out) operations

Overview

Queue manages data using the FIFO (First In, First Out) principle as a collection. Use offer to add to the tail, poll to remove from the head, and peek to check the head without removing.

Specifications

  • Create a Queue<String> using LinkedList
  • Use offer to add "Alice", "Bob", "Charlie" in order
  • Use peek to check the front element (without removing) and output
  • Use poll twice to remove and output
  • Output the remaining queue size

Output Format

Front: Alice
Polled: Alice
Polled: Bob
Remaining: 1

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up