It looks like that this Q&A was answered back in the day on StackOverflow. How to close such questions?
Already answered elsewhere is not a close reason and has no reason to become one in my opinion.
We do have a close reason stating:
Questions about general programming problems are not on-topic unless they relate to DevOps in some way. You may be able to get help on Stack Overflow instead.
which was discussed here Add an off-topic close reason for generic programming questions and may fit the question you linked.
The main reasoning should be 'is this question on topic for our site ?' the fact it is on-topic elsewhere is not specially relevant to close a question here, we can have some overlap with others site on the network.
I think this answer of Shog9 and the comments under it are still applicable to our site at this time.
And a relevant meta.se question on the same subject for the same conclusion: Is “closer match to another SE” a reason to close an on-topic question as off-topic?