| I have been thinking about this. For eg, let's say I am following implementing a design pattern and I am stuck at implementing a specific feature adhering to that pattern. I usually search for it online and then try to implement as suggested (I don't have much experience, I am a new grad). What do you think?. Should I implement my own solution first even if it violates the design pattern, then check if my solution was correct, or do I search on the internet the correct way to implement the feature? |
There's a period of time where it's worth trying. It varies a lot, depending on your willpower and how important a problem is.
If you're just trying to solve a Hackerrank problem, you should probably spend 30-60 minutes on it. You'll want to go long enough to not get frustrated with it.
Sometimes copying solutions is better. I learned map(), reduce(), filter() that way - these are all things that can be solved a slow way, but doing it in less lines of code is very good.
You can try copying a solution, then try solving the problem again based off memory. It's good to practice repeated basics like array manipulation and type conversion until it's muscle memory. Design patterns tend to be quite rare and it's fine to do it once and reference it every other time.