4 ms·
IIRC, Joel's thesis was could not program anything. I believe his example was fizzbuzz, and he stated an absurd number of people could not do that in an hour
by seadan83 2y ago
IIRC, Joel's thesis was could not program anything. I believe his example was fizzbuzz, and he stated an absurd number of people could not do that in an hour
- vidarh 2y agoThe level of tests I've seen many places includes stuff like reversing a string, or if you want to be fancy, reversing words within a string. It takes shockingly little to filter out a lot of people, and I'd argue that often you want it to be at a really stupidly low level for a first pass, even when using tests they surely must have seen before.
- LoganDark 2y agoReversing the order of the words, or the order of the characters within each word?
- vidarh 2y agoEvery variant is fine. It's really the kind of thing you do for the most basic possible filter. The point isn't so much what they do, as whether they're able to produce any working code more advanced than Hello World. But it's also then possible to make use of "one step up" by asking people for variations and seeing whether they can talk about tradeoffs (still at a very basic level, but still). E.g. in a higher level language, if asked to reverse the order of the words you often get variations of split on space, reverse the resulting array, join. In which case you have an opening to ask them if they can do it lower level, in minimal space. In which case, the "typical" solution becomes to reverse the string in place, then iterate and find the start of each word, and reverse that in place. Both reverse operations need at most two pointers and a temporary, and can be done with the same function if you take in a start and end pointer. If you have that helper to reverse a given character range in place, reversing the order of the characters within each word without reversing the word order is just the same thing without reversing the whole string first.
- all2 2y agoWhy not both? Bonus points if you require the ability to reverse any given word in a sentence.