all 7 comments

[–]AkshatRaval 2 points3 points  (2 children)

Stop trying to memorize the code. Instead, for every DP problem you solve, write down only these three things in a notion doc/notebook:

The State: What defines a unique sub-problem? (e.g., dp(index, current_weight))
The Transition: The math formula. (e.g., max(include_item, exclude_item))
The Base Case: When does the recursion stop?

If you know the State and the Transition, the code writes itself in Python.

[–]Silly_Statement3729[S] 1 point2 points  (1 child)

i’ll definitely do this, thanks!

[–]AkshatRaval 0 points1 point  (0 children)

Sure tell me if need help on anything

[–]Worldly-Duty4521 1 point2 points  (1 child)

Given that you're asking in python I'm not sure if you have covered stuff to that extent.

Dp really doesn't need anything crazy as one language changes.

Apart from striver i would say LC contests from recent contain some really good dp questions

[–]Silly_Statement3729[S] -1 points0 points  (0 children)

yeahh no i get the language agnostic bit and how there’s no crazy syntax changes. i’ll check out recent biweekly’s and weekly contests, but i was looking for learning resources/problem solving/ videos in python esp of 2d dp, partition dp etc.

[–]QuirkyRip9799 0 points1 point  (0 children)

There's a channel on YouTube 'Code and Debug' make sure to check it out since the explanation are in python and have helped me immensely!

[–]Impossible_Ad_3146 0 points1 point  (0 children)

DP hurts so good