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

FWIW the second example of finding halfway points in https://web.stanford.edu/class/cs9/sample_probs/ListShufflin... is buggy. Crashes if the list have odd number of elements.


"Your job is to write a function that accepts as input a pointer to a linked list with an even number of elements"


Would writing it to handle odd numbers of elements as well cause the employer to move forward with a different candidate?


This may not have been a serious question but I'll give a serious answer: depending on the interviewer, you could get bonus points for going "above and beyond" or, yes, you could be penalized for "not reading the spec."

I've found that the best way to handle it in a conventional whiteboard interview is to mention it when appropriate and offer to add the functionality later.

"Now, here's the part of the code where I'd deal with odd N. Since we're guaranteed even N in the problem statement I'll skip this for now, but we can come back to harden this function later if you like."


Maybe. All other things being equal, they might need a reason to cut you, and hire the other guy.

If you failed to complete the problem or took longer than expected to complete it because of extra complexity entailed by a more "correct", out-of-scope solution, it may especially cost you - even if in the end, your solution was "smarter".

Maybe the other guy noted that there are a couple of ways to solve the problem, and asked a clarifying question about it.


Fair enough :-) I'll read more thorough next time.




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

Search: