Unfortunately, once you start using the solutions, you are practicing different skills. Writing code and reading code are not the same thing. Reading code won’t help you write code. Watching sports doesn’t make you a star player, right?
A more helpful strategy is to ask questions so that others can help you write the solution yourself.
Thank you for this answer!! I’ll be on the forum more often now for this. Thanks
I mean, I would say that reading does help somewhat. I mean, athletes watch and analyze sports footage all the time or read books on fine points, etc. But they don’t only do that - the most important thing is quality time on the field and the gym. And I agree that reading code in this context will make it more difficult to learn to actually write it. But I agree with the conclusion.
Algorithms can be hard. And unfortunately we throw a huge pile of them at you all at once (I wish we could sprinkle them around). Don’t get frustrated, most people struggle here.
But if you run into trouble, definitely ask. Looking at the solution should be a last resort, the nuclear option - you will learn a lot from your struggles.
Now, after you have solved the algorithm, that is an EXCELLENT time to look at other solutions, see how other people solved it, what optimizations they found, etc. I used to do those algorithm challenge sites and I learned a lot from seeing other people’s solutions. Of course, with those sites, you usually can’t see them until after you have successfully solved them - that is a good thing.
Totally agree here. Taking apart and comparing other solutions with the one you just wrote is a great thing to do.
Thank you for the advice!! I do agree and see how this would work :). I’m going to use this!
To add to what has been said, what helped me the most when going through the algorithm section was writing down every step I thought I needed to solve the problem then coding these steps in order, this way if there’s a step I don’t understand how to code, I just google that part learn how to code it and move on, once adopted this approach the challenges became much more manageable for me.
As an example say I’m asked to find the longest word in a string , my editor would look something like this before any code:
// I need to go through each word in the string
// On each word, I need to find the number of letters
//I need to keep track of this number
// I need to update this number when the next number is greater.
With this approach my odds of solving the challenges dramatically improved
This is a great idea. Coding starts before you touch the keyboard.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.