Quick meta-info:
I was looking for really right place for this question, there is none on stackoverflow. Still answering this question requires programming experience.
I am senior software engineer and lead node.js developer in company with 250 employees, therefore I am doing technical interviews. I am here only for 2 months, so I do not have that much experience with it (previous company was much smaller, so hiring new backend guy was very rare).
The part of interview is live-coding, usually through skype. I think this is quite important, because some people are really not able to do almost anything.
But there is one thing that bugs me - a lot people failing on task "find second biggest number in array" which I think is very easy.
I usually write them this piece of code with only limitation - dont sort an array and dont use any special functions for arrays:
const _arr = [1, 7, 8, 5, 4, 2];
function findSecondBiggest(arr){
}
console.log(findSecondBiggest(_arr));
And task is to write code into function that finds second biggest number. I thought this would be just "check" question and would be "just do it" for most programmers.
Even the developers that look quite promising are often failing on that. I know that they are under pressure, but I am even trying to guide them, calm them and they have at least 20 minutes (often even 30 as I stay 10 minutes more on the call to give them chance to finish it). A lot of developers look very promising - they have good experience, knowledge, are able to evaluate why they are using this framework/technology... But are not able to do this one.
I have consulted it with Technical Lead and he says that if they are not able to do this, we should discontinue - as we are looking for the programmers and we are expecting to write code. Also the company is interested for mid to senior level developers.
Is this task really that hard? Or is it a good one that really shows if you can come up with at least simple algorithm and implement it?
I am also accepting the solution where you use two for-cycles when first one finds the biggest number, the second for-cycle finds the second biggest number as it is still O(n).