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

If it helps, this type of problem has come up precisely zero times ever. Use a built in function, loop through the array, and if in the future it's running slow, _then_ optimise


You don't need to optimize prematurely, but you should understand when/why/how to optimize something like this off the top of your head if you ever want to work at a company that deals with non-trivial amounts of data. If that's the hardest question I got asked at an interview, I'd never take the job.


Hi. I wrote the post. I'm releasing a free ebook next Tuesday where hopefully I can change your mind. (I also wrote The Little Redis Book and The Little MongoDB Book, so hopefully you'll give me a chance!)


How nice of you to share! Thank you Mr. latch (:




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

Search: