Am I doing this learning thing wrong?

I have been learning javascript on and off over the last year. I enjoy doing algorithms on FCC and on Codewars and I even manage to solve them (most of the time). However, I tend to look at the solution after I figure it out and the most advanced solution is much shorter than mine and uses a completely different technique. I understand what is being done but then I get sad that I did not come up with such a solution on my own.

I tell my self that on the next problem I will try to solve it using advanced methods, but then when I attempt the problem I feel like my brain will explode, so I solve it using the “long way” and the loop just starts over.

Should I just try to get comfortable with solving algorithms and stop looking at the short solution, and then 6 - 12 months down the road start to make my solutions more elaborate or should I keep looking at the short answers and attempting to use those methods in my work?

Try to apply the advanced techniques on not-so-complicated projects, so you get used to them and overtime will be able to use it in the bigger things.

Some (most?) of the advanced solutions are really, really advanced, made by people with years and years of experience. So don’t be discouraged if that path is not the first to come to your head when trying to design a solution.

Being able to solve them is a merit on it’s own, whatever the code length. You can always come back and refactor it whenever you feel comfortable with advanced techniques.


There is an order to things,
We used to have a problem, we needed to get to places but the horses were lazy and refused to run for 50 mile commutes. We invented a car.

Was that solution the best? What happened? We invented a car that was only a little better than the horse, but it was a solution.

Ford made the model T, looked at it, made it again better. Better, better over time.

Same here. The advanced algorithm tricks are not in your tool belt 24/7 even if you understand them.

You start by making them work. Then understand EXACTLY why your code works. Now shrink it.

As you learn to shrink things down with the more advanced tricks you will see your code again and see where those tricks apply.