Hacker News new | past | comments | ask | show | jobs | submit login

And my favorite answer to questions like this is, "Can I just use grep (or shell commands in general)?"

Grep, uniq, wc, and a few others can be treated as pipeline data transformers to answer questions like this interview question. As long as you make some smart decisions about the order of operations, you can usually get performance on par with what you might write custom code for.




You would definitely pass if I interviewed you, as long as your solution was reasonably efficient.

I would love to interview a candidate that can show they can use command line tools effectively.


Because shell command injection and process spawning time are not always acceptable side-effects.


And one of the appropriate questions would be, “Is this a one-off or rare request, or does this need to be productionized? And how sensitive is the response time? And if it must be fast and frequent, then why are we not using some form of indexed db”


Out of curiosity, how would you solve this particular problem with shell commands?




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: