Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think I'd panic if I got that question in an interview. Where do you start with that? What are the first steps? How did you know what to Google?


It sounds like a test of your ability to abstract, componentize, and prioritize. Here's a possible approach to this sort of problem:

Read a brief summary of whatever you are implementing, even if you are already familiar. This will help you understand the breadth of the problem.

Try to list in very broad terms the data structures you will need to store the state of the problem (e.g. for Minesweeper, a grid of tiles, and for each tile some status). Don't worry about whether you are using a list or a vector/array or sparse or dense matrices, just be as generic as possible.

List in very broad terms the logic of the problem. What states exist, what are the beginning/ending conditions (start/playing/win/loss), very roughly how states transition, etc. Again, avoid detail.

Identify the inputs and outputs of the problem, very broadly (e.g. user input, display for game board -- no mention of mouse, keyboard, HTML, or whatever).

Cycle through these phases a few times until they seem to agree.

From there, go wherever your brain takes you, progressively filling in details of your design. You probably still shouldn't start coding.

For a 1hr exercise, let's assume you've used 15 minutes for the design phase. Now you can begin coding. Start with the very core of the problem, writing data structures and logic around those data structures. Then get some way of displaying them and manipulating them so you can debug with feedback.

With a roughly functioning core, start filling in the rest of the design. Focus on what makes the biggest functional difference with the least effort first, if at all possible, but again, follow your brain. Try not to pick fonts before you've got everything running. Go piece by piece, until time is up.

--

As for what to Google, you'll need to know how to interface with your problem's input and output systems (like a browser), and maybe how to run timers or store your particular data structure, but most of the work is design, not research.

--

For a personal story, several years ago I failed a similar test in an interview. They asked, "How would you make an elevator?" I got lost in the details like what type of screw terminal to use for electrical contacts, and only later realized the value of prioritizing layers of abstraction. Breadth-first search, not depth-first, if you think of a problem space as a graph.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: