Answering a closed question, or giving hints where to find an answer, in comments is almost always okay, no matter what the question is about.
There are a couple exceptions, say totally extreme cases like when the question was about something illegal, or deeply immoral, or asked in bad faith (trolling etc.). But other than that, answering a closed question in a comment is totally okay. I do it all the time for off-topic or Not A Real questions that are good, but simply don't happen to match Stack Overflow's guidelines.