4 ms·
If the candidate does great, I'd definitely move on to more complex problems. But this question lets me learn a lot about the candidate: - How quickly did the
by kartickv 9y ago
If the candidate does great, I'd definitely move on to more complex problems.
But this question lets me learn a lot about the candidate:
- How quickly did they come up with any working solution?
- How long did it take them to reach the optimal solution?
- Do they know time complexity?
- If they're using Java, did they use a plain array or ArrayList? Do they understand boxing and performance?
- Do they understand the range of an integer? I'd tell them that the array represents the population of the earth every year from 1900 till today, and see if they realise that they need a 64-bit integer.
- seanmcdirmid 9y agoAs for the last point, would you expect them to tell you it's impossible for populations to go negative?
- kartickv 9y agoNo, they should be able to make that common-sense assumption, and you need a 64-bit integer in either case.