3 ms·
One of my favorite anecdotes, that I read on hn and unfortunately didn't save, is that a constant space algorithm for loop checking in a linked list was an open
by x0x0 10y ago
One of my favorite anecdotes, that I read on hn and unfortunately didn't save, is that a constant space algorithm for loop checking in a linked list was an open question for a long time. The rabbit and hare algorithm was novel enough that it was first published by Knuth in 1969.
So if you're asked that question in an interview, it's only checking if you've heard the answer. Because you almost certainly aren't going to come up with it on the spot.
That said, if you want to work at goog/fb/amazon/et al, you have to study, and that's a common dp problem. Put in your 100 hours of studying and you'll do fine. And before you grump at me, that's not an endorsement of this (I think it's quite silly), but we all know the deal. So stop whining and study before your interview, or don't bother interviewing with the well known list of companies that love algorithm bingo.
- tarr11 10y agoI agree. This is a sort of meta-interview. Facebook is looking for (Devs Who Can Implement CS Algorithms) ∩ (Devs who can game the system) The second criteria is arguably more important when working for FB, than the first.
- srtjstjsj 10y agoKnuth's paper gave incorrect credit to an earlier paper that did not mention the algorithm. The tortoise and hare algorithm is so simple that it was never published as a novel result, it was never an "open question". It was just something people figured out when it came up. https://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_hare https://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_h...
- deleted 10y ago[deleted]