Here’s a fun little coding challenge that most of us (devs) have come across at some point in our lives. It’s not too difficult, and proved to be a lot of fun here at the NML offices. It should take about 15 minutes to complete. (Perhaps 30 minutes if you’re going for the win*.)
If you’d like to tackle this one, email your solution (in a zipped text document along with any special instructions) to us at email@example.com with the subject line: Christmas Tree Challenge or just tweet us at @NewMediaLabs. We’ll post solutions next week, along with Challenge #3.
PS – Submissions for our first challenge will receive feedback in a follow-up post. So, stay in the game.
Write a little program that outputs something like the following:
* *** ***** ******* ********* ***********
Restrictions and Criteria:
- The number of rows must be an input into the program. So one should be able to draw a tree with 10 rows or 100 rows with modification. It is the only input that should be required.
- You can use any language of your choice (C#, Java, JS, PHP, Python, Erlang). The more interesting, the better your chances of impressing you, me and everyone in the Internet.
- You need to choose how you want to implement it. We will judge based on equally important criteria, and you have freedom to choose how you want to approach it. You can either go for extremely elegant, or extremely readable, or both or all.
Criteria to be fulfilled:
- Is the code efficient?
- Is the code elegant?
- Is the code readable?
- Is the code reliable?
Winnings include social media displays of affection and a beer on us – if you want to pop in for a visit._