Introducing the Coding Challenge

Welcome to the Coding Challenge.

Here I will post a coding challenge every few days that you can solve. There will be easy ones and hard ones, pretty mixed.

How does it work?

  • Try to solve the challenge in whatever language you find fitting
    • You can use a new language you always wanted to learn or show off your golfing skills
  • Post a comment containing your code (in ```code here```) and some info on how the code works or what is remarkable
  • Optional: Create a post with the tag #coding-solution
    • In that post walk other users through the process of solving your challenge. That way they can learn and try it out on the next one
  • Optional: Read and review other peoples code, try to find bugs, give feedback and learn

Why even bother?

  • Training is everything, the more you train your mind to think in code, the better you are prepared
  • You may learn a few new tricks from reading other solutions
  • I will send tips for really good solutions (and use the liquid rewards of this post for it too)
  • You may get recruited if someone likes your code (f.e. I am looking for talents)

Challenge #1 – FizzBuzz

This challenge is a pretty basic one, but the devil lies in the detail.

Implement a fizzbuzz function taking an integer n that abides to these specifications:

  • if n is a multiple of 3, print Fizz
  • if n is a multiple of 5, print Buzz
  • if n is a multiple of 3 and a multiple of 5, print FizzBuzz
  • in all other cases print the number

Also create a snippet or main function that calls fizzbuzz for all values from 0 to 100, ascending.

Remarks:

  • If you use a pure functional language, try returning a string instead of using a print Monad (both are allowed)
  • Bonus points for:
    • handling edge cases
    • good coding practices and modularity
    • useful and meaningful tests
    • beautiful (readable, self-documenting) code

Please keep the #coding-challenge tag clean of solutions.

H2
H3
H4
Upload from PC
Video gallery
3 columns
2 columns
1 column
86 Comments