Easy csharp

Queue — FIFO demo #40

Problem

Enqueue 1,2,3 then Dequeue and print.

Hints
  • Enqueue / Dequeue

Your practice code

Ready — edit the code above and click Run.

Solution

using System;

class Program
{
    static void Main()
    {
        using System.Collections.Generic;
        var q = new Queue<int>();
        q.Enqueue(1); q.Enqueue(2);
        Console.WriteLine(q.Dequeue());
    }
}

Try solving on your own first, then reveal the official answer.

Explanation

Queue is First-In-First-Out—BFS uses queues.

Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details