This is the transcript of the mock interview with Candidate AB (2years)

SDE Guru: Hello, Welcome to the IM interview. Thank you for taking the time to talk to me.
Candidate AB: Thanks you, the pleasure is all mine

SDE Guru: Can you briefly describe your background and experience?
Candidate AB: Sure. My name is AB, I finished my undergrad in the 2006 and then started to work for ABC Tech as Software Developer / Senior Test Engineer. After a 2 year stint there I joined McDufee as a Software QA Engineer. In 2009, I started my MS in Computer Science in UC. I am presently working on my thesis and and I also work as a part-time student researcher at Children’s Hospital R & D centre.

SDE Guru: Excellent! Where do you see yourself 5 years from now?
Candidate AB: In 5 years from now, I see myself as a Tech. Lead, reviewing code and providing optimization solutions in a well established product development company

SDE Guru: What is your favorite programming language?
Candidate AB: I prefer Java. I also have an experience with other languages

SDE Guru: I see, Can you rate yourself in Java on a scale of 1 to 10, 1 = worst, 10 = best ?
Candidate AB: I shall rate myself as a 7

SDE Guru: Why do you say you are a 7, and what will it take to get you from 7 to 8?
Candidate AB: I say 7 because while I have used Java and J2EE for the past 5-6 years in developing small scale applications, I am not very comfortable with internals of java. To get to a 8 or a 9, I expect to learn and understand various memory management techniques and garbage collection optimization techniques. In terms of frameworks and API’s, I want to learn the implementations of Hadoop and map reduce framework using java. I also want to learn more about the other java APIs available like Jena and Jung

SDE Guru: Great.. Shall we get on with a coding question?
Candidate AB: Sure!

SDE Guru: Implement the stringToInteger function using first principles. int stringToInteger(String str). By first principles, you cannot use any inbuilt libraries functions. like Integer.parseInt(str)

Candidate AB: What does the string have? Only numbers or can it include the sign?
SDE Guru: yes.. good clarification question. It may contain sign, The input will match [-+]?[0-9]+

Candidate AB: ok, can I assume that the input is valid and has no leading 0s
SDE Guru: Does that matter? How does the answer to this question change your approach?
Candidate AB: Well, I am just thinking if that is the case I may eliminate running through the entire string and just take a substring for it. On second thoughts, I don’t think it would matter. Let me explain my algorithm first?
SDE Guru: Go ahead!

Candidate AB: I am thinking of, starting by first checking if the string has a + or a – sign as the first character and setting a boolean flag for it then taking a loop, from the last character to the position 1 and just multiplying it by the place where it belongs to. I mean 10th, 100th, units place and so on like that like that and finally add a sign to the result

SDE Guru: ok that sounds fair.. can you code this up?
Candidate AB: Do I assume that the input size shall be of size integer? or can it be larger than that?

SDE Guru: Assume, string will fit the integer range.

Candidate AB: Give me a few minutes to code, Output is not what I was expecting.

SDE Guru: Can you try testing with “0”, “1” and then debug?

Candidate AB: can I use the function character.digit ?
SDE Guru: Go ahead.

Candidate AB: Here is the update code, it works for most part, but fails for the first case.

Candidate AB: Give me a few moments, I know where the problem is, fixing that now.

SDE Guru: Any questions for me?
Candidate AB: any suggestions on how can I improve?

SDE Guru: It was nice talking to you. I suggest setup another mock interview in two weeks time to measure your progress.
Candidate AB: The pleasure was all mine. I shall do that

SDE Guru: ok..Best of luck
Candidate AB: Thanks a lot

Interview Review:

  1. Good summary of the background and experience. Only suggestion there is that it seems more of a listing than functional. There was no mention of what was done at each position
  2. Not a very strong answer to the 5 years from now question. Most developers do “code-reviews” within 6 months to a year of joining a firm.
  3. Very good answer on the Language Rating question.
  4. On the coding question – Good parts.
    • Reached the final answer
    • Good clarification questions on signs, and the range.
  5. On the coding question – Bad parts.
    • Bad clarification question on the leading zeros? It was inconsequential.
    • Specifically provided the signature stringToInteger(String str), the code ignores it.
    • In between, additional test cases like 0,1 were prompted, these were ignored too..

Overall verdict: The candidate will most likely be moved on to round 2, for another phone interview. However, based on the answers it is unlikely that the candidate will be asked to come for an Onsite.

Additional Notes:
Other test the candidate missed is very long (valid) input string like “11111111111111111111111111111111111111111111” where the result would overflow.
Even if you said that the input is in the form [+-]?[0-9]+, he should first validate that the input is in this form (test cases: “-/+a”, “a1”, “”, null).