Since this was a homework question I was trying to get the the poster to understand their problem. Rather than just answering it.
Maybe that's wrong on SO but I thought it was a good approach.
Do the panel concur?
Your approach is great to guide a student. You're helping by guided discovery. Asking questions to steer the student in the right direction, without providing the answer. Because giving the straight answer will most likely make the student think "I understand, that's absolutely logical", without truly understanding the problem and solution in the end.
There is one big but. This is a Q&A site. Question and Answer. By engaging into what is essentially a conversation with the OP, you will end up having just that: a conversation. And this might go on for a while, with the comments on the site not exactly being helpful when trying to express yourself (lack of formatting for example). So besides not arriving at a single answer (Although in the end you could perhaps summarize all into an answer) you are fighting against the insuitability of SO for such extended discussions. (Something it will warn against if it goes on for long enough, by suggesting taking it to a chat room).
So to answer your question:
Was I wrong in my approach to this question?
In general: No.
For SO: I would say so, because in my opinion it's simply not a good fit for the format of this Q&A.
Perhaps you could have made your thoughts into an answer which does not provide a direct answer to his question, but steers him in the correct direction nonetheless.