Intermediate·Concept·2 min read

Stack and queue in .NET

Practice this question

Stack

csharp
var stack = new Stack<int>();
stack.Push(1);
stack.Push(2);
int value = stack.Pop();

Queue

csharp
var queue = new Queue<int>();
queue.Enqueue(1);
queue.Enqueue(2);
int value = queue.Dequeue();

Problems to practice

  • Valid Parentheses
  • Min Stack
  • Daily Temperatures
  • Largest Rectangle in Histogram
  • Sliding Window Maximum
  • Implement Queue Using Stack

Adapted from 17_DSA_DOTNET.md · “5. Stack and queue in .NET”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.