Should your answer to the JS challenges be exactly the same as the solution provided to you by FCC?

I was doing project Euler challenges for practice and I barely had started with problem 3: Largest Prime Factor. Although I got the answer correct however it was 35 lines as oppose to FCC’s solution which had 10 lines.

I was wondering, does it matter what your answer looks like? It probably does but when i look at their solution, i wouldn’t really exactly know how to come up with that solution by myself unless I really did speculate math in a different POV with practice.

So does it matter whether your line of code is 35 lines as oppose to 10 lines? Mine had a lot of logic behind it if and thens and such but their solution was quite impressive.

The number of lines or extra variables don’t matter. Did it pass within the time limit? The Euler challenge can be computationally intense, so that is really the only metric.

Of course, as your skills mature, revisit the challenges. See where you might simplify or streamline. Don’t try to beat FCC’s shared solution. Just try to beat yours.

1 Like