One problem, one weekend, eight languages

I have gotten quite complacent about using the same language for solving programming challenge problems such as those on HackerRank. I wanted to take a problem and write the solution in multiple languages to get a feel for them and see if there are any that I prefer to the one that I normally use (ignoring performance considerations for the time being).

For this personal challenge, I chose the Zombie March problem from HackerRank and ended up writing the solution in 8 languages: Go, Ruby, Python, Scala, Java, JavaScript, Clojure, Groovy (in no particular order).

I don't claim to be good in any of them (with the exception of one perhaps) so I'm sure I've done plenty of non-idiomatic and otherwise silly things.

Full sources are available on GitHub and each individual solution is linked as well.

The languages

In no particular order...


A nice upgrade from C but too low level for my preference.
Saves you from some of the hair-pulling that one might encounter when writing (or debugging) C code as it's much easier to write safe code.
Compilation speed is fast (at least on my silly code).
"Declared and not used” being an error is a bit too much for someone just playing around but I can see how it could be useful in a real Go program.


Syntax is nice, rich collections, everything is an object. Not a lot of surprises.


Nice, but a bit turned off on how collection operations are performed.
Can't invoke operations like map, filter, etc directly on a collection.


Pretty good. Rich collections.
Some temptation to write code that's a bit too concise but that's not strictly a Scala problem.
Some of the syntax may take getting used to.


No generic array instantiation. Had to create a separate class to avoid having an Object[] array.
Parsing input is a pain. Limited collection operations and no lambdas.

JavaScript (Node)

Limited collection operations. Some operations mutate in place and don't appear to have immutable alternatives (sort, reverse).
Was really taken by surprise that sorting an array of floats sorts them in alphabetical order.
Failed some of the test cases (didn't have time to figure out why).


Clojure took the most time to figure out.
Parsing the input data was the biggest challenge and I don't think I did it in a particularly nice way. I'll need to come back to it.
Some of the exceptions that I encountered were a little cryptic and took time to figure out.
Apart from the learning curve, it seems to be a nice language.


Was able to write the solution in a more functional way than I could with Java.
Encountered a strange issue where the reader passed by inputStream.withReader would return extra blank lines.
Didn't pass two of the test cases as it took too long to run. (Didn't spend any time profiling).

What language should I use for programming challenges?

In terms of writing code, I had the most fun with Ruby. Unfortunately it's well known that it tends to perform worse than some other languages which makes it harder to pick.
I also enjoyed using Scala and I think I should spend some more time experimenting with Clojure.

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.