Re:Ask HN: How do you approach a problem when you are stuck?
by muzani on Tuesday March 10, 2020 @11:51PM
(#22542810)
I assume you're learning, not debugging.
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.
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.