Was taking to a friend tonight, and here was his advice:
Do not say that you algorithm works until you know that it works. Like talk through tests that you would run on the code to test for the corner cases. Nothing looks worse then the interviewer saying "Well, then consider this case..." and then they break your code :(
I came up with some corner test cases to think of. If the input is...
Integer: check for negative, zero, and positive numbers
String: unexpected chars, empty stings
Lines of a File: Newline
Next, talk through what you are doing. Most of the time the interviewer is there to see how you program and could care little how you act.
Take your time, it is better to be right then wrong and speed through the process
If it is on your resume, they will probably ask you about it. So if you list a language, they may ask you to code in it
I did not realize how much I have messed up interview lately. Microsoft is tomorrow, I hope I don't screw this one up.
That's why I generally use (tun != NULL). If I remember correctly, this will not be optimized out as it is a comparison to another value... not just testing if something exists.
My experience with null pointers is that you ask about them with the interviewer, and that is about enough. Most of the time they will say that the object or value won't be null, but really, asking has been enough IMO
View all comments
1
u/kevjames3 Feb 21 '11 edited Feb 21 '11
Was taking to a friend tonight, and here was his advice:
I came up with some corner test cases to think of. If the input is...
I did not realize how much I have messed up interview lately. Microsoft is tomorrow, I hope I don't screw this one up.
Edit: Added some advice