The only bad thing in programming is about give up and throw it away. It's nice to lose some time to accomplish some goals and it's fine if something get your time by 2, 4 or 12 hours.
The point here is every developer have their way to make things and not all are the same, for example me some times there is problem that i resolve quickly and others than struggle in my head and don't see the solution.
Keep making things and with you goals and do the best, there is no problem to spend some time to fix something :)