Not sure where the bottleneck is, but once you know your functions, data types, loops, variables, conditions - then you've got most of the essenital tools. When it comes to string formatting and such, that's just a matter of using a search engine. If you look something up often then you'll start remembering it, and if not, then you don't need to.
With the ability to manipulate values and looking up functions out of the way, you can focus on the problem without being limited by your understanding of the language. You're looking to pick apart the problem, look for solvable parts, finding alternative perspectives. Enter the world of mathematicians.
There is certainly much to know about how to implement the solutions that you dream up, but the real action is where you get to distance yourself from the computer a bit and just think in terms of what can be executed, what can be done
Definitely don't try to do your reasoning in code as you try to come up with a solution to a problem, you would be limiting yourself. And additionally, it is useful to split up the work of figuring out a solution, and implementing it. If you do both at the same time, you're making it much more difficult to do either. (divide and conquer, split up a problem into simpler ones, solving them individually, here into solution and implementation)
It may also be useful to write down the solution in English. You can for example write each step as a comment, to be accompanied by the corresponding code at a later time. Intentions being stated in comments helps quite a lot in debugging as you can read the code and consider if it matches the intentions.
You might also come across solutions which are completely unreadable with single letter names and super short. don't do this - you're gimping your ability to reason about your own code. This is something one might do to shave off a few minutes for code that you can write in your sleep, code that will only be used once and then discarded. If you have to keep everything in your head all at once and have to look at where names were defined to figure out what they represent, then you are making it very difficult for yourself.