Created
December 9, 2020 20:56
-
-
Save JohnMGant/4cbd6710433fe29f259e95b2a3d337ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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