Prompted by the recent-ish question How to scramble a word, keeping first and last characters the same? (JS), and today's MSE post about it: Question closed as off-topic after following suggestion in Meta.
I assume we closed this question because it was focused on why a specific piece of code did not run fast enough, which is normally a StackOverflow question. Based on this user's meta post, it is now retroactively obvious that the user was more interested in improving the algorithm than in JS-specific optimizations, and had reason to believe his question would be accepted here.
While it's probably too late to undo the damage (judging by the user's displeasure with us), it does seem like it wouldn't have been terribly difficult to edit the question into one focusing on the algorithm rather than the code. I was honestly a bit surprised to see my name on the list of close voters.
As you can see, the question got good answers, and the answers were about the algorithm rather than the specific code. In other words, the apparent off-topicness of the question did not encourage any off-topic answers (as so often happens with unclear/broad/POB questions).
While the question as written is a better fit for StackOverflow, it's so easy to edit it into a good fit for Programmers that I think we messed up on this one.
Whenever we see a question about fixing/improving code that can easily be interpreted as asking us to suggest a better algorithm, should we edit it to focus on the algorithm instead of closing it as off-topic?