Practice ยท 3 of 3
Debug: The Support Queue That Serves VIPs Last
CHALLENGE
Difficulty: intermediate+25 XP
Serve must pop in FIFO order, but the current implementation serves the LAST added ticket first (a Stack is hiding where a Queue belongs). Fix Serve (and only Serve โ Add is fine) so tickets leave in arrival order, and Pending stays truthful.
``csharp
public class SupportQueue
{
public void Add(string ticket);
public string? Serve(); // null when empty
public int Pending { get; }
}
``
Press Submit to check your solution.
Back to lesson: Practice: Collections & Complexity Practice