Can a candidate be judged by asking to write a complex program on "paper"?

Posted by iammilind on Programmers See other posts from Programmers or by iammilind
Published on 2011-09-21T08:54:16Z Indexed on 2011/11/20 18:24 UTC
Read the original article Hit count: 245

Sometime back in an interview, I was asked to write following program:


In a keypad of a mobile phone, there is a mapping between number and characters. e.g. 0 & 1 corresponds to nothing; 2 corresponds to 'a','b','c'; 3 corresponds to 'd','e','f'; ...; 9 corresponds to 'w','x','y','z'.

User should input any number (e.g. 23, 389423, 927348923747293) and I should store all the combinations of these character mapping into some data structure. For example, if user enters "23" then possible character combinations are:

ad, ae, af, bd, be, bf, cd, ce, cf

or if user enters, "4676972" then it can be,

gmpmwpa, gmpmwpb, ..., hnroxrc, ..., iosozrc


Interviewer told that people have written code for this within 20-30 mins!! Also he insisted I have to write on paper.

If I am writing a code then my tendency is as of I am writing production code, even though it may not be expected from me. So, I always try to think all the aspects like, optimization, readability, maintainability, extensible and so on. Considering all these, I felt that I should be writing on PC and it needs decent 2 hours.

Finally after 25 mins, I was able to come up with just the concept and some shattered pieces of code (not to mention of my rejection).

My question is not the answer for the above program. I want to know that is this a right way to judge the caliber of a person ? Am I wrong / too slow in the estimates ? Am I too idealistic ?

© Programmers or respective owner

Related posts about interview

Related posts about programming-practices