Hacker News new | ask | show | jobs
by swanson 4630 days ago
I think you misunderstood the problem statement. The hash is keyed by the URL and the value is the body of the HTML page. The input to `search` is a term, so you would need to check all of the items to see which one contained the term in the HTML. The subject could not just index directly into the hash.
1 comments

If you're just doing keyword matching, you're best off building one of these first:

http://en.wikipedia.org/wiki/Inverted_index

As for the interview, I really wouldn't sweat it. Even if you didn't do well in the eyes of your interviewer, 1. there are several interviews that they are looking at, not just one, 2. people understand that folks get nervous and can screw things up sometimes, and that whiteboard (or google document) coding isn't the best measure of intelligence. Because of this, they're usually more interested in how you respond to feedback than the merits of your first attempt, and 3. there's a lot of luck to any interview process - what questions get picked, etc. and even if you don't do well I wouldn't discourage you from trying again in the future.