Any solution to challenges or all solutions?

So I am working my way through the JS Basic Algorithm Challenges and just finished the Return Largest Numbers in Arrays challenge. I passed the challenge (yay!) but I went to the “Hints” section afterwards to compare my answer and see that fcc lists 4 ways to solve this challenge. My solution matches the “procedural method”.

Thing is, the other 3 ways listed to solve it I would not have come up with at this stage (and they have much less code). I’ve noticed this same sort of thing on the last couple of challenges.

I “get” the recursive approach and I used recursion to solve the “Factorialize” challenge, but the 2 Declarative solutions to this are not intuitive to me like the other ways. Once I studied them several times I understand them but I am still not sure I would come up with them again on my own, so my question is should I be focusing on being able to solve these challenges every way listed or just solving them with whatever I come up with?


Don’t worry about digging into the various listed solutions. People come to the challenges from different backgrounds and experience.


yes i would’t worry about all the different ways to solve an algorithm just learning to problem solve is what you should focus on first, and better solutions will come naturally once you are more familiar with javascript.

also less code is not always the best way to go, as it might not be as efficient for instance stringing higher order functions you could solve a algorithm in one line of code, but that one line contains 3 loops when you could solve the same one with more code and just one for loop.

1 Like