FizzBuzz - my first interview task on whiteboard
I think we all know the FizzBuzz task, when we a function shall print fizz if the number is divided by 3, buzz if by 5 and fizzbuzz when by both. Yesterday I did a small research about how many different implementations we can have using C# and there were many. Ones looks very common with "if" statement tree, some of them were using LINQ and looking hard to understand what is going on in a first instance. StackOverflow has this one question with a bunch of examples Writing FizzBuzz , that I will use to check how those solutions work from a performance perspective, code complexity and human understanding. listing 1 fizzbuzz question As we can see, OP introduced a tuple to solve the problem, which in my opinion gives a lot of opportunists for extensions with a little code changes. The metric looks good, but if we move the list declaration outside the function (so it is not recreated every time the function is called we shall be good) To do benchmark I will convert