Earlier quoted context omitted.
I think the code people have to write in interviews is not supposed to work/scale in the real world. The purpose usually is to test whether the candidate can implement a correct algorithm. Even though this is Java (?), it's used more like pseudo code. A follow up question could be: "Do you see some problems with running this with big numbers? How would you scale it?"
>> I think the code people have to write in interviews is not supposed to work/scale in the real world. The purpose usually is to test whether the candidate can implement a correct algorithm Do you check for nulls in linked list traversals? Potential stack overflows? How about array out of bounds? If yes, why don't you check their data type? Do you now see why this process is fucked up? The candidate doesn't know wha…
No, the process is not fucked up. There is no one right answer. It is CLEAR that the candidate cannot write perfect code in an interview. But it can still provide valuable data.
Basically it can answer to this question: "has the candidate got _any clue_ about programming?". Sometimes that has a lot of value.
Think about a candidate that cannot even write a function that calculates the length of a null-terminated string, for example. Doesn't that test tell you immediately that something is terribly wrong? I've seen these candidates.
When you get over a certain skill threshold, every candidate passes the coding test. After that, it's useless, of course. Then it's probably best to show some code and discuss.
NO SINGLE recruitment test can provide absolute certainty. Coding in interview is just one variable.