It took me a long, long time until I became reasonably confident that most problems would eventually succumb to my programming ability. Probably almost twenty years from when I wrote my first program, or a few years after college.
I can't write code on my own, though -- unless the problem is trivial and the APIs I'm using I know like the back of my hand, I need an Internet connection to do it.
Part of this issue is possibly that competent people are disproportionately stalked by the worry that they're secretly incompetent.