I tend to ask what I think is a rather simpler question in most interviews: find the sum of the two largest (most positive) numbers in an array of arbitrary integers. Consider the efficiency of your solution for very large arrays. It is amazing how many seemingly knowledgeable, intelligent people cannot do this. And the vast majority of those who do, do it by sorting the array, efficiency be damned. Actually, I'd lik…
I have seen plenty of useful code far worse than sorting such an array. IMO, someone missing the 'obvious' choice in an interview question is completly reasonable. Thinking back how many people verified that the array was non empty and it had more than one element? I call it the toy problem mindset, when coding you consider things deeply but in meetings your looking for roadblocks not optimal solutions. PS: From a pr…
I'm not sure what your PS is referring to. Which posted solutions, and what article?