I wrote the search function without problems; I’m surprised that so many failed in the comments. After all, unlike the people from Bell Labs / IBM, they had the extra info that 90% of programmers fail at this; so they should have been extra careful about edge cases. Or do people really think “I’m so sure I’m smarter than 90% of IBM programmers that I won’t double-check my code”? It’s not as if a bit a thinking can’t bring up the expected edge cases (empty array, element not in the array, element at an extremity).
(That being said, maybe my solution has a bug I haven’t seen yet ^-^ The only ‘problem’ I had is that my function will say that 2.0 is in an array containing [1, 2, 3], but the spec doesn’t say how we should handle different types (would unicode and non-unicode versions of the same string count as the same?))
In the blog’s comments, and especially on Reddit and Hacker News, I was amazed at the amount of rationalization by people arguing that this wasn’t a good test—that since it wasn’t representative of “real-world programmer work” (because a programmer would be able to test, or would use a library function), it wasn’t a good metric of programmer skill. Now, it may not be a perfect metric, but I’m sure I’m not the only guy who, all else being equal, would rather work in a team with other programmers who pass that test.
(There also seemed to be a few people on Reddit saying “Oh, I passed the test, except for this little bug that doesn’t really count”)
I wrote the search function without problems; I’m surprised that so many failed in the comments. After all, unlike the people from Bell Labs / IBM, they had the extra info that 90% of programmers fail at this; so they should have been extra careful about edge cases. Or do people really think “I’m so sure I’m smarter than 90% of IBM programmers that I won’t double-check my code”? It’s not as if a bit a thinking can’t bring up the expected edge cases (empty array, element not in the array, element at an extremity).
(That being said, maybe my solution has a bug I haven’t seen yet ^-^ The only ‘problem’ I had is that my function will say that 2.0 is in an array containing [1, 2, 3], but the spec doesn’t say how we should handle different types (would unicode and non-unicode versions of the same string count as the same?))
In the blog’s comments, and especially on Reddit and Hacker News, I was amazed at the amount of rationalization by people arguing that this wasn’t a good test—that since it wasn’t representative of “real-world programmer work” (because a programmer would be able to test, or would use a library function), it wasn’t a good metric of programmer skill. Now, it may not be a perfect metric, but I’m sure I’m not the only guy who, all else being equal, would rather work in a team with other programmers who pass that test.
(There also seemed to be a few people on Reddit saying “Oh, I passed the test, except for this little bug that doesn’t really count”)
Yeah, but you yourself fell prey to the same trap in reverse: claiming the test is important after passing it successfully :-)