3 ms·
An anecdote: I prepared a little bit with Hackerrank for my Google interview (in Oct 2018) and never once encountered a problem where a linked list would be rem
by oerpli 6y ago
An anecdote:
I prepared a little bit with Hackerrank for my Google interview (in Oct 2018) and never once encountered a problem where a linked list would be remotely useful. I also watched the YT video about why LL are useless in practice in most cases (cache locality etc) and I therefore eliminated them +- completely from my "toolset" (despite being actually pretty comfortable with them (spent a lot of time implementing sort algorithms on single & double linked lists).
Then, one of the interviews had some problem about a scenario that wasn't actually that far away from something one could encounter in real life and the optimal solution (by far) was with a simple linked list.
I completely blew it. I devised some convoluted MinHeap solution with Log(n) that was confusing as hell and my interviewer was wondering why he's wasting his time (he didn't tell but it was my impression). In the last few seconds he said something like "do you know a data structure with cheap inserts at the end and start" and everything was clear (but to late).
No hard feelings, wouldn't have hired myself after that performance as well.