Skip to content

Instantly share code, notes, and snippets.

@JohnMGant
Created December 9, 2020 20:56
Show Gist options
  • Select an option

  • Save JohnMGant/4cbd6710433fe29f259e95b2a3d337ee to your computer and use it in GitHub Desktop.

Select an option

Save JohnMGant/4cbd6710433fe29f259e95b2a3d337ee to your computer and use it in GitHub Desktop.
internal class QueuingAdder : IIntegerAdder
{
public int Add(int[] values)
{
var queue = new Queue<int>(values);
var sum = 0;
while (queue.TryDequeue(out int value))
{
sum += value;
}
return sum;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment