4 ms·
Always fun to see this kind of Rosetta Code thing, feel like no matter the topic there's something to glean from reading! That said: if I ever gave the palindr
by pentaphobe 1y ago
Always fun to see this kind of Rosetta Code thing, feel like no matter the topic there's something to glean from reading!
That said: if I ever gave the palindrome question to a candidate (I haven't) and they pulled out a `reverse` library func/keyword we'd be encouraging them to do more.
- chriswarbo 1y agoHaskell's default `String` type is a singly-linked list of `Char` values[0] so it takes O(n) time to access the end of the string. Hence I think the solution using `reverse` is probably the best there is, since any attempt to be "smarter" would just be more complicated for no real performance gain. Though I agree that we could ask someone to also write their own reverse function. [0] https://hackage.haskell.org/package/base-4.21.0.0/docs/Prelude.html#t:String https://hackage.haskell.org/package/base-4.21.0.0/docs/Prelu...
- pentaphobe 1y ago"... write their own reverse.." Yeah spot on - exactly what I was aiming at too... Having the intuition to use reverse (& pragmatism to keep it simple) is a great sign, and realistically more valuable [to me] for hiring than implementing rudimentary algorithms, but... still want at least a bit of both abilities Also knowledge of standard library / language features is useful but (for me) doesn't equate to abilities in complex problem solving. But honestly could be bias :)
- kevincox 1y agoI generally say something like "You can use whatever libraries you like but I reserve the right to ask you to implement them yourselves". This allows them to focus on the part they want to focus on and shows good decision making about not re-inventing the wheel, but if they "outsource" the core of the problem (or we just have extra time) there is an obvious step deeper that can be taken. I usually even say that they can make up library APIs if they want, because I don't really care if they have memorized the python stdlib, I just want to seem them think about and work on a coding problem.
- pentaphobe 1y agoThat's a great approach - definitely adding your framing to the toolbelt, thanks for that! kind of organically landed on a similar thing, where initial task is kept pretty simple (but not covered by common libs) Some folk solve and code this quickly, so we add a requirement. (Generally up to a few stages - think like Advent Of Code) Any leftover time can be spent discussion wishlist items for productionising, optimising, tests, etc.. But: plenty of people only complete the first stage, but this can absolutely be a pass too (based on comms style, approach, etc..)