I was minding my own business and googling about how python implements exceptions handling, when all of a sudden, I received the tempting offer to foobar. It’s nicely done with what looks like some javascript animation, which reminded me of the scene from the film “The Matrix”, when Neo gets contacted by Morpeus. And down the rabbit hole I went…
I’m mostly a C++ programmer, as this blog should make clear. But over the past few years I’ve been getting more seriously into python. Probably the fact that C++ and python work so well together has something to do about it. I’ve been considering including some python in these posts, perhaps this will be the push I needed.
Why I did it? I love coding competitions. I used to be pretty active in HackerRank competitions, even though they used to be hosted at ungodly hours in Asia (ie. from 1-3am). So I didn’t need much prodding. I hadn’t heard about the foobar challenge before, so I approached it assuming is just for the fun of it. It also had the feel of a well constructed algo challenge.
The approach: once you receive the first challenge, you find out you can provide your solutions either in python or java. I chose python. The next important thing is to read the constraints.txt file. This explains mostly obvious things, like no io, a list of excluded libraries, and that the version is set to 2.7.13. Which is quite important. This also led me to suspect the challenges haven’t been maintained much if they’re using an older version of Python.
Timeline: Overall I spent a total of 6 weeks on the challenges. I worked on them almost exclusively on weekends, so it’s not too surprising. I think it would be possible to complete all the challenges in 2 weekends if one really were to focus and hammer them out. But where would the fun be in that?