Skip to main content

Get the Reddit app

Scan this QR code to download the app now
Or check it out in the app stores

r/leetcode

members
online

How do you guys get good at DP?

I'm really struggling with grasping DP techniques. I tried to solve/remember the common easy-medium problems on leetcode but still get stuck on new problems, especially the state transition function part really killed me.

Just wondering if it's because I'm doing it the wrong way by missing some specific techniques or I just need to keep practicing until finishing all the DP problems on leetcode in order to get better on this?

------------------------------------------------------- updated on 26 Jan, 2023--------------------------------------------------

Wow, it's been close to a year since I first posted this, and I'm amazed by all the comments and suggestions I received from the community.

Just to share some updates from my end as my appreciation to everyone.

I landed a job in early May 2022, ≈3 months after I posted this, and I stopped grinding leetcode aggressively 2 months later, but still practice it on a casual basis.

The approach I eventually took for DP prep was(after reading through all the suggestions here):

- The DP video from Coderbyte on YouTube. This was the most helpful one for me, personally. Alvin did an amazing job on explaining the common DP problems through live coding and tons of animated illustrations. This was also suggested by a few ppl in the comments.

- Grinding leetcode using this list https://leetcode.com/discuss/study-guide/662866/DP-for-Beginners-Problems-or-Patterns-or-Sample-Solutions, thanks to Lost_Extrovert for sharing this. It was really helpful for me to build up my confidence by solving the problems on the list one after another(I didn't finish them all before I got my offer, but I learned a lot from the practice). There are some other lists which I think quite useful too:

* https://designgurus.org/course/grokking-dynamic-programming by branden947

* https://leetcode.com/discuss/general-discussion/458695/dynamic-programming-patterns by Revolutionary_Soup15

- Practice, practice, practice(as many of you suggested)

- A shout-out to kinng9679's mental modal, it's helpful for someone new to DP

Since this is not a topic about interview prep, I won't share too much about my interview exp here, but all the information I shared above really helped me land a few decent offers in 3 months.

Hope everyone all the best in 2023.



Bryan Bonilla, fashion brand co-founder, uses Adobe Acrobat AI Assistant to find the insights he needs to inspire new ideas – in seconds.
Bryan Bonilla, fashion brand co-founder, uses Adobe Acrobat AI Assistant to find the insights he needs to inspire new ideas – in seconds.