So basically I’m working my way through the JS exercises, and I’m finding myself getting stuck a lot. I mean really stuck, like spending all of my free time on 1 exercise. I didn’t keep track of the time, but yesterday I spent all day(off and on) stuck on 1 problem. When I finally did figure it out, I was happy because I completed it without looking up the answer, but I was also unhappy about the amount of time I spent figuring out how to make 1 simple function. This is the exercise if you’re wondering.
Would I be better off setting a time limit for exercises, such as 1 hour? I personally think I’d be happier with that, but I don’t know if it will come back to bite me when I get further into the course. I’m stuck on another exercise today, and at this rate I might actually get burned out before I ever get to doing real projects. For the record, I do enjoy the problem solving aspect, but I would much rather be doing it for personal projects than for exercises.
Which exercise? I think you meant to link to it, but didn’t.
FWIW, it took me about 10 days to solve the smallest common multiple one… And months of abandoning and returning to the cash register one.
If the material on FCC is your first ever experience with programming and developing algorithms based on a given set of instructions, then do not worry at this point how long it took you to solve it. The majority of campers end up peeking at finished solutions or need multiple hints based on forum questions to solve many of the first algorithm challenges. The fact that you solved it on your own without asking for help is a major accomplishment.
The more you practice these types of challenges, the easier it will become over time. Over time could mean 1-2 months or it could mean 6-12 months. Also with time, you will get better at recognizing similar patterns and be able to quickly apply the right type of algorithm to solve a particular problem.
As far as setting time limits. I would not set a time you think you should be able to solve a particular problem, because each problem is different and you will not know what time is correct until you finish it. Instead, I would set time limits for the amount of time you sit and work on a particular problem before taking a break. A break could mean 30 minutes, a couple of hours, or coming back the next day. Sometimes it helps just to take a break and let the problem sink into your head as you are doing other stuff. When I get stuck on how to solve a programming problem, I find it beneficial to get outside and go for a 30 minute run to work things out in my head. Typically, I will think of a couple of things to test out when I return from my run. Just sitting for hours on end can be very frustrating and over time can lead to losing interest.