No, this shouldn't be closed! I see no reason at all not to allow language-agnostic algorithm questions here. Heck, they're explicitly allowed by point 2 of the "Asking" page in the Help Center:
What topics can I ask about here?
... if your question generally covers...
- ...
- a software algorithm, or
- ...
- ...
… then you’re in the right place to ask your question!
That's pretty explicit. The fact that Computer Science Stack Exchange exists (and would also be a reasonable place to post this question) does not nullify what the help center says; it's been thoroughly established by now that some questions are on-topic on multiple Stack Exchange sites, and that's fine.
Really, I can't make sense of why anyone would choose to close this. We're talking about a question that:
- Is of a type explicitly permitted by the Help Center
- Is well-written, specific, interesting, and (in principle) answerable
- Is the sort of problem a future programmer would come across and Google while programming, looking for an answer on Stack Overflow
- Is thoroughly within the area of expertise of Stack Overflow users (and indeed an answer has already been given)
I've voted to reopen. Closing perfectly good, relevant questions like this is precisely what gives Stack Overflow a bad reputation for overly-strict and arbitrary moderation.