Intermediate algorithms, very stuck at the middle

So until the challenge “Sum all Odd Fibonacci Numbers” my ego was having a thrill and how damn fast I was getting done this challenges. I thought oh man, now I’m getting it, now I reaaaally now how to approach a problem and solve it through Google but without peaking into solutions.

After I encountered this problem. I thought FCC has made me unbreakable to frustration until this point, but no, this problem is getting through my bones and what I’m pissed is not about not knowing how to solve it but rather I’m not handling well the frustration and self doubt.

I am considering peeking at solutions but I know that is not the way. I’ve battling with loneliness over 3 days with this algorithm and I wonder if I’m losing my time trying to prove something. Never know if I should look at solutions or not, but if I look now I know I’m not going to have learned anything.

I

1 Like

So the challenge asks you so sum all odd Fibonacci numbers up to a value.

So that indicates it needs a loop. The way you calculate a Fibonacci sequence is that you add the previous two numbers. So you’re going to need to use the loop to keep track of three values: those two previous values + the next one in the sequence. That loop should stop when the value of the next one goes past the input value. So if you are building the Fibonacci sequence, you should be able to figure out how to keep a running total of all odd numbers.

thanks. I don´t know why but I was with this obsession last week that I had to solve it through recursion… now this morning i´ve been trying just to solve it through a loop and of course, is not so damn difficult haha

Now I feel like dumb having made this thread…but Idk why i thought it had to be made with recursive functions

Don’t feel dumb! It’s dead easy to get stuck thinking a specific problem needs one specific solution, go down a rabbit hole and get trapped there. This will continue happening, you’ll just get better at recognising when you’re doing it (you will still do it though, it’s very easy).

This is doable with recursion btw, basically the same as the loop version: recursion finishes (by returning an accumulator) when the condition is met, the function needs to take those three values.

1 Like

If your struggling then your learning. If your flying thru the challenges, odds are you aren’t learning much. Programming isn’t easy, but anyone can do it! It just takes time and grit to get thru more difficult problems, which is to be expected.

You will never become unbreakable to frustration, since there will always be a problem that just seems “too complicated”, or too much for you to handle. But this doesn’t mean you give up, you just need to keep trying, thinking of different approaches, methods, asking for help (as you did here), getting some extra insight into the problem. Its possible you overlooked something and thats fine! everyone is human haha, don’t think you will be perfect, no one is haha.

I appreciate your willingness to stick with the problem, and not look at the solution. I personally would of given up long ago and looked for help haha. But don’t think looking at the solution isn’t learning. You can look at the solution all you want, but understanding why it works, how it works, and what you were missing from your own approach is the real learning. Don’t think passing challenges is learning, learning is in the process, not the reward.

For example, now that you struggled with this problem, I’m sure you learned a lot right? If you were to get lucky and finish the challenge by pure luck the first time, I don’t think you would of learned nearly as much as you did with struggling.

This is why struggling is a good thing, it might suck, but its good for you haha.

Goodluck, and keep it up :smiley:

Thanks a lot for your message bro, I reaally appreciate. Also makes me very happy because almost all the things you are saying I was “discovering them” lately but hey, i wasn´t sure if it they were true or it were just another “justification” to don´t feel “impostor” because of not understand things or getting stuck with a project/challenge.

Now i clearly see that the real justifications are completely the opposite! The things we tell ourselves to let us see a solution very early before really having exhausted all our efforts, or copy-paste code instead of really thinking through a solution on our own…