When I interviewed for Amazon for a Java position, they had a C guy give the interview. When he asked me to implement atoi() on Java, Integer.parseInt() was the not correct way to do things at Amazon. After that it was all sys admin questions about the version of Linux they use.
Somehow I managed to pass to the next level. I told them no thanks.
When he asked me to implement atoi() on Java, Integer.parseInt() was the not correct way to do things at Amazon.
I have to agree with them here. If you're being asked to implement a function for parsing integers, they're clearly not looking for an answer of "I call a function which parses integers".
I had the same problem with Microsoft (atoi), and the same issue with the interviewer (being a C guy)...the issue there was that he thought (stringInstance).length() was an O(n) op, so the fact I was calling it in my loop meant my algorithm was O(n^2). My explaining that, no, Java stores the length as part of the object...kinda tanked the interview.
You describe the "interview anti-loop," a term coined by Steve Yegge, a prolific blogger who wrote about the Google interview process. Better luck next time. I've come across it a few times myself. Also I've legitimately bombed interviews, sending apology emails to the recruiter immediately after leaving.
Oh, there won't be a next time. A bit of sour grapes, but I also legitimately don't want to work for Microsoft. Even then it was more exploring my options; that interview tanking was more cynically amusing than it was disheartening.
I don't know how to get straight ascii out of a java string off of the top of my head. I guess in this situation i'd start with a little discussion of unicode, then just start with something like
Somehow I managed to pass to the next level. I told them no thanks.