This is good advice but there's an important caveat. After spending 15 minutes trying to answer the question you should still ask the question
even if you have an answer. The problem with the advice is that it implies questions have one good answer. For most dev questions there will be many answers, and a lot of them will be awful.
For example, if a junior asks themselves "How do I sort this list of things?", they'll probably come up with a solution inside of 15 minutes if they're good. That solution probably won't pass a code review though.
The issue is that as a new dev you don't have the depth of knowledge to understand whether you solution is actually a good one or not. Talking about your idea with the rest of the team is critical for learning about some of the nuances around solving problems.
(This also applies to more senior devs too. Everyone should be talking about what they're doing occasionally.)