Yes, exactly. The one line is to call a sort, the few lines is to just loop over it.
The point is, is that if someone cannot take a simple business requirement (“I need to find the highest number in this list”) and turn it into step-by-step pieces of code (“let me look at each item in this list, and if it is higher than the last ‘highest value’ I already found, I’ll consider it the current ‘highest value’, and then return it”), how in the world can they translate a more-complex business requirement into code? This is something that legitimately takes everyone who gets it a few minutes at most to write it all all, and well under a minute to consider how to do it (some folks start asking questions about performance, or ask if a sort is fine, etc., others get hung up on the use of pseudocode, a few got into unasked for detail with imports/using statements, and so on). But the point is… this isn’t a tough thing to do. It’s not a math test.
But your expectations that this is looking for “code challenge heroes” is just absolutely false. I’m not looking for people who can hold a lengthy discourse on O numbers and optimized routines (that’s premature optimization), while I do appreciate someone asking for things like “what’s the typical list size we expect to see?” for some context, we are indeed looking at their process. Can someone take a simple requirement and turn it into code? It’s the exact same thing as FizzBuzz (which I originally was using, but was becoming very well known). When people use a foreach on the list, they often improperly initialize their max value to 0, and it means it fails with all negative numbers. Are they going to test that? If they make that kind of basic mistake, what other mistakes does their code have?
But this is such a basic, simple, CompSci 101 task, that I find it impossible to comprehend that someone can fail to do this or even struggle with it, and have any success as a developer, regardless of their process. Most of the successful people we hired did this task in a few moments with little hesitation; many of them took a step back and had some doubt because they were shocked it was so easy, they were looking for a “trick” that I had hidden in the question.
J.Ja