How to approach algorithm scripting challenges


I get stuck a lot on question in algorithm scripting module. How should I approach them? Right now, I am just looking at the solutions, understand it and then code answers using the same approach. Its making me feel inadequate though.

Any other approach? I try googling too but looking at the solutions saves time.

Thank you,

I wouldn’t look at the answers. The important thing is to practice meddling through the problem and getting something that works.

I’d start by breaking the problem into pieces and coming up with a plan. Somewhere along the way you’ll get stuck. That’s where the forum comes in. Show us the code, describe your plan, and tell us where you got stuck. We’ll help you get unstuck.

1 Like

Thanks @JeremyLT
Will do that.

Hi @deetigupta8 , first of all you have to understand the task, if it’s math’s kind of challenge then you should ask yourself how would you solve this in real life then try to translate the idea into code. you can log the variables to console to see what’s happening inside the program and check is it the way you want it to be, in the process your thought process will kick in and act accordingly. I also like the test cases of freeCodeCamp, if your code does not solve any test case then think again. once you have solved the challenge then you can refactor it to make it elegant

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.