On the spectrum from direct instruction (I tell you/show you what to do) to inquiry (I set up a situation for you to use some of your prior knowledge to learn something new) it sounds like you leaned towards inquiry here.
You experienced the power of this yourself when you were younger so it's no surprise it informed how you chose to help/not help.
You used a mix of collaborative and cognitive questioning to both engage the learner in the problem and help them think through it. ------------------------
Next I'd like to ask you some questions to help you think through two important teaching concepts: 1) Productive struggle 2) Feedback
Was the student at a complete loss with what to do? Given time to take a break, maybe even sleep, and revisit the problem, do you think they still would have been at a loss?
If no, then give them time and space to think through it on their own or use cognitive questioning as you did to help them think through it.
This gets us to the concept of productive struggle. It is just as the name sounds. This concept has well researched benefits for learners.
If the student had no idea what to do and you suspect would merely get frustrated then that's struggling and its not productive. It's the kind of situation that leads to poor first order outcomes and has second order outcomes like making someone hate the thing you are trying to help them learn.
In that event it would be best to either help them through the problem with advice or find a different problem for them to work on that they have enough prior knowledge to productively struggle with.
Next up is feedback...
Did the student get any feedback after they made their choice? If it was programming could they run their code and see if it worked? Was it a binary right/wrong?
If it didn't work did the student have enough prior knowledge to work around any roadblocks they might encounter?
These questions take us back to the concept of productive struggle.
1) productive struggle is good 2) feedback or advice should be timely and based on what a learner needs to keep them from struggling unproductively
There are related ideas...some lessons you may have a focus and so you tell the student certain things that aren't the focus of the lesson instead of putting them in an inquiry situation. This is another skill needed for effective teaching: creating, selecting, and sequencing a curriculum.
Implied in all of this is the importance of knowing the content, how you want to teach, your learner's prior knowledge, and how they are reacting to the problem.