4 ms·
> One of my programming interview question is a flawed piece of code implementing an algorithm. The algorithm is there in its entirety, so there is no need to a
by tzs 4y ago
> One of my programming interview question is a flawed piece of code implementing an algorithm. The algorithm is there in its entirety, so there is no need to actually recall the details of it. The task is to point out and fix functional flaws, then critique and fix non-functional problems.
That's similar to what I plan to do if I ever find myself having to interview job candidates.
My plan is to have a selection of LeetCode problems that I have solved before and ask the candidate to pick a two or three of that seem interesting. I will NOT ask them to actually solve them or code solutions.
We will just talk them over to come to an agreement on what the problem is asking for, talk about what edge cases we might have to worry about, and then toss out suggestions on how to approach it. A whiteboard would be available. I'd try to let the candidate take the lead in the discussion, just contributing myself enough to keep things moving if the candidate seems stuck on something.
Once we've got a solution (regardless of how much of it came from the candidate and how much came from me moving things alone), we'd go the the discussion section for that problem and take a look at the solutions people have posted, and I'd ask the candidate to check a few of those for correctness and to suggest improvements.
A lot of the solutions people post in the discussion are wrong, ranging from just simple coding goofs (like not initializing a variable or using the wrong variable) through missing an edge case all the way to just flat out their algorithm is just wrong.