23 ms·
Genuine question, but what is so difficult about reversing a linked list? I don't have the algorithm memorized, but i can deduce in 10 minutes at most.
by victorhn 10y ago
Genuine question, but what is so difficult about reversing a linked list? I don't have the algorithm memorized, but i can deduce in 10 minutes at most.
- jogjayr 10y agoNot everyone can come up with an answer under a pressure situation when put on the spot. I've managed it in an interview but it was quite stressful.
- joshvm 10y agoIt's not, at all, but it took me by surprise and I made a mess of it. In hindsight the answer was less than 10 lines of python. The next time I went round an interview loop I rote learned all the CS101 stuff, because that's what you have to do (I'm not a computer scientist). The issue was that the comp contained a lot of stuff that you couldn't deduce in 10 minutes. For example, all-shortest-paths graph search, performing huge calculations (e.g. stuff that blows up extremely fast), monte carlo simulations and other bits and pieces. It would have made for a much more interesting interview.