To give some context, I'm 17 and I have been programming for a few years.
I was doing a code challenge on codewars.com, (similar to project euler), that involved converting to and from negabinary numbers (base negative 2). I had never heard of, nor even considered numbers with a negative base. But I managed to figure out some patterns in the tables the problem gave me and wrote a nice converter from negabinary to decimal. But the other way around, that was a different story. I tried for hours to figure out a way of converting decimal to negabinary but to no avail. It got reasonably late so I slept on it. The next day I tried for hours again but still couldn't figure out an algorithm. After this I googled it, found a wikipedia page with an algorithm all ready and waiting for me.
I had solved it, albeit with a little "research"...
I want to be the best programmer I can, and I think I'm on the right track by attempting these coding challenges. But I'm a little lost on what I should do when I'm faced with a situation like this. Almost all the problems I'll solve (at least early on) will have been already solved brilliantly by someone else. I'm sure If I was working, my boss wouldn't be impressed if he found out I'd spend the best part of 2 days trying to solve a problem that I could have solved in 2 minutes If I had googled it. But googling it feels like cheating, and I don't get to practice my problem solving abilities.
It seems like the best programmers are able to take problems that no one has solved before and develop solutions on their own.
I guess what I'm asking is how do I get really fucking good at problem solving? By spending massive ammounts of time thinking through problems for myself or by looking at as many past solutions as possible?