3 ms·
I think the author may be missing the point of this exercise. Solving this problem requires the following things: 1) Decompose a number into digits. Less exper
by detrino 11y ago
I think the author may be missing the point of this exercise. Solving this problem requires the following things:
1) Decompose a number into digits. Less experienced candidates will likely convert the number into a string and then the characters back into numbers while more experienced candidates will tend towards a small loop using div and mod.
2) Use some kind of library to insert and test membership in a set data-structure. Less experienced candidates may not be able to do this without stackoverflow, big red flag.
3) Some basic flow control wrapping it all together. Less experienced candidates may fail here similar to fizzbuzz.
The interviewer likely thinks these things are a good proxy for the quality of a candidate. For example, the author would have failed #1 even without miscommunication/stress/time constraints.