Why is this question closed as “unclear what you are asking”?
Great question. Though, somewhat moot as the question is no longer closed as "unclear what you are asking". I do think the question is reasonably clear, in terms of understanding what kind of answer the question is intended to elicit.
Explaining the "unclear" close votes definitively is impossible, except by asking those who voted that way. We have no way to see the individual voting history for the earlier closing of the question; it's possible there were a couple of "too broad" votes, but of course at least three of the five votes must have been for "unclear".
Perhaps one person did find the question unclear and two others followed suit because they were trigger-happy to get rid of a question that they intuitively felt should be closed but hadn't thought in depth enough about why it should be closed. Maybe all three votes were from such people, just using "unclear" as their default for "I don't like this question but I'm not willing to put enough effort in to figure out why."
On the other hand, perhaps the voters looked at the question and determined that the single interrogative sentence in the question was probably not really the only thing that the owner of the question intended to ask, but found it unclear as to what exactly that owner did mean to ask. I.e. the question as posted was in fact legitimately unclear to them.
You'd have to ask each of them directly, to know for sure why they voted that way.
That said, the question does seem clearly "too broad" to me, and has in fact now been closed using that reason. If nothing else, the "Looking forward to any comments, suggestions and inputs" is explicitly soliciting an overly broad discussion and debate about the question, rather than a simple "yes" or "no" answer (which is all that would be seen if the primary question were taken literally).
One signal that the question is poor and inappropriate for Stack Overflow is that its sole tag is algorithm, which is hardly a good, descriptive tag. It tells you basically nothing about the question that would distinguish the question from other questions on Stack Overflow. Maybe this is just a case of the owner of the question failing to find a better, usefully descriptive tag. But it's definitely not a good sign.
In fact, one of the other things the question suffers from is a complete lack of evidence that the owner of the question made any real effort to research the question. It didn't take me long at all to find several articles on the web that address this popular programming puzzle, and yet the question doesn't mention even trying such a search, never mind describing what they found and what specifically they were having trouble understanding.
So, yes…I suppose you technically have answered the single phrase in the post that had a question mark. But it's likely that's not really all the OP was asking for. Indeed, telling them that their proposed algorithm doesn't work probably doesn't get them to where they want to be; now they will require a whole series of follow-up discussion to arrive at an algorithm that does work. It's that discussion that also is a hallmark of a question that's too broad.
I'm sorry if you feel your efforts have been diminished in some way by the poor response that the question got. For better or worse, one of the primary functions of the Stack Overflow community is not to answer questions, but rather to evaluate the questions critically, and make sure the question really is a well-researched, on-topic question that deserves an answer. To answer a question before being really certain of that is to risk the rest of the community voting down and/or closing the question (or in some cases even your answer…especially if you seem to not have really offered a complete answer to an overly broad question) due to the poor quality of the question.