|
|
|
|
|
by randrews
5946 days ago
|
|
I could not agree more. The thing I finally realized is, it doesn't matter. Someone who will struggle reversing a linked list will struggle on any coding problem, no matter how simple. The one I ask is: given a string, return a hash where the keys are each letter in the string, and the values are how often it appears: "hello" becomes {"h"=>1, "e"=>1, "l"=>2", "o"=>1"}
This question has stumped almost everyone I have asked it to. Either they just sat there and wouldn't code it, or they made insane mistakes like getting the syntax of writing a function wrong, or they couldn't write a loop that worked.I let them do it on a laptop, I let them look at any API documentation they want, and I offer them help when they're stuck. It doesn't matter. Would they also flail trying to reverse a linked list? Sure, definitely. But why bother? This is the simplest thing that will cause non-programmers to flail, so why make it hard? Plus the added benefit: a manager might claim "when will they ever need to reverse a linked list?" but nobody's going to say that writing a loop is unreasonable. |
|