Leetcode - Best Practices - Dynamic Programming

Hey guys,

I have a quick question. I'm currently struggling with dynamic programming problems as the intuition to solve them don't come to me as easy as other people. I'm currently focusing on solving a lot of DP problems in Leetcode. However, I end up being stuck in the brute force approach (recursion) and can't think of how to cache or store sub-problems. I am tempted to look at the solution, but at the same time I don't want to do it because if I just keep looking at a solution, I will really never solve problems on my own. I will, instead, just memorize solutions to a problem which is not what I want to do.

What do you guys do when you can't find the most optimal solution to a problem? Do you take a look at the solution? What are some best practices one can do while solving Leetcode problems?

Thanks.

Comments (2)