2 ms·
I'd expect anyone I interview to be able to do that, kind of like fizzbuzz. It's okay if they pull out the sort-the-array solution first, but I'd definitely tr
by Blackthorn 12y ago
I'd expect anyone I interview to be able to do that, kind of like fizzbuzz.
It's okay if they pull out the sort-the-array solution first, but I'd definitely try to get them to improve it.
- tempestn 12y agoYes, I agree with this too. And in some ways sorting is a better solution. The code is certainly simpler. That said, once you point out that you need an efficient solution for large data sets, a competent developer should be able to recognize how to do that. Heck, even if they just said, "ok, so you need to loop through it and keep track of the two largest numbers", then messed up the details, that would be better than most of the answers I've seen. (Again, from people with reasonable-looking applications and resumes.)