Mine sweeper
A while back a friend of mine applied to a large and growing tech company. We talked about the interview process at such a well known organization.
To my surprise, he said that they only gave him one coding challenge: in one hour, create Minesweeper in the language of his choice. He used Ruby.
This was a backend interview. They only wanted the mechanics, not the UI. The test was to see how well the applicant knew the language. More importantly how well did he utilize data structures. Could he foresee potential issues with a given implementation?
I decided I would try to repeat the exercise following all the same constraints. I used PHP.
Tests aside, I wrote a completely functional implementation in one hour and thirty minutes. I did get a little stuck with a recursive function. In my defense, when my friend and I started speaking, we were watching the third to the last Warriors game during finals. I had already had a few beers.
Most of what you see in the repo is true to the original thinking and original code. I did add unit tests and linted the code after the fact and made some code modernizations. I use this repo as a way to learn new things in PHP even though I do not use it professionally anymore
I’ve kept this repo around for a few reasons. It works a bit like confidence boost. It is also a great reminder that there are many ways of solving a problem. Finally, it is a reminder that sometimes constraints can help you focus and get things done.