by tomsmeding · 6y ago · 0 comments
(EDIT: after thinking about this more than two seconds, the quadratic algorithm for unsorted input can become n log n by sorting the list, though that takes linear space. This would certainly be a clarifying question.)
The other questions would be less obvious to me, though I'd encounter them while thinking more than 2 seconds about the problem, I suppose.
Or maybe this just outs me as an ex-amateur competitive programmer :)
Just because you can ask a question whose answer makes a drastic difference between the best algorithm involved, doesn't mean it is a good question.
(and note I said "_almost_ make me dock points...". And if the answer to the question was "yes, the list is sorted", I would _certainly_ dock points off of the interviewer/company if I were the interviewee for not giving that context).