I need a plan to improve myself in DP as i think this topic is hard to me and don't know the main idea of it and when we use DP in general.
| № | Пользователь | Рейтинг |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | strapple | 3515 |
| 6 | tourist | 3470 |
| 7 | dXqwq | 3436 |
| 8 | Radewoosh | 3415 |
| 9 | Otomachi_Una | 3413 |
| 10 | Um_nik | 3376 |
| Страны | Города | Организации | Всё → |
| № | Пользователь | Вклад |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | adamant | 152 |
| 3 | Um_nik | 146 |
| 4 | Dominater069 | 144 |
| 5 | errorgorn | 141 |
| 6 | cry | 139 |
| 6 | Proof_by_QED | 139 |
| 8 | YuukiS | 135 |
| 9 | chromate00 | 134 |
| 9 | TheScrasse | 134 |
I need a plan to improve myself in DP as i think this topic is hard to me and don't know the main idea of it and when we use DP in general.
| Название |
|---|



There is a playlist of Shayan
https://youtube.com/playlist?list=PLzDmwrrgE-UVKGwxoYao36BVTvBozwLoG&si=YFCKfC59NI-LMqX7
Thx bro
You can check our roadmaps too prepared by Repovive team (including Shayan) https://repovive.com/roadmaps
Thanks bro, It's perfect.
i think the most important part in dp problems is first to recognize if the problem is dp, and how to find transitions and also sometimes u may need some observations to optimize the complexity.
How can i learn that?
ig it comes with practice and solving problems ,for me the most straighforward to practice dp,is to just tag dp in the problemset,and pick some considerably recent probelms and try to solve them.
As for me, I keep in mind that DP is mainly used in problems related to counting or on problems where we need to do an optimization to find a minimum or maximum number of operations/value. This helps me in recognizing a DP problem. Apart from that when its hard to find a good logic just try thinking of the problem in a DP or recursive way.
as you said "DP is mainly used in problems related to counting or on problems where we need to do an optimization to find a minimum or maximum number of operations/value.", I just wanted to add that, dp is also used in problems where we need to make decisions in every step, the difference between dp and greedy is that in greedy we mainly choose one (!) approach and apply it in every stage, whereas in dp, we should consider all the possible situation on that specific stage and then make a decision for that particular situation, where finding the specific formula or approach to make that decision is the main idea in problems.
I just wondered; if you've practiced alot before and then posted this blog, maybe the problem could be from the "implementation knowledge" you have, cause the implementation in dp is somehow deep and maybe confusing.
what worked for me was that I just tried to close my eyes and trace 2 or 3 nested
forloops, while updating some matrix, both forward and backward methods, then when I've got familiar with this kinda of situations, recognizing dp problems wasn't that hard and the fun part was that how can I apply the idea in those nested loops while using and updating my matrix :)Tried to do my best as simple as possible <3
If you want to become master in DP then prefer this series. Contains 12 different DP Patterns (1D To Graph DP). 160+ DP problems in which 115+ are from LeetCode. Which means by the end of this series you'll end up solving 115+ DP problems of LeetCode. Its for free on LeetCode: https://leetcode.com/discuss/interview-question/5659029/ultimate-dynamic-programming-series-on-leetcode
Thanks but it contains the solution not videos to explain how to think in problem and get solution.
Here 12 DP Patterns with video lectures: https://www.youtube.com/playlist?list=PLiF6lAo--At1-wfJi5qwVxqwAsSEOkDMK
AtCoder Educational DP Contest solve this
Thx bro.
CSES dp section, Atcoder educational dp contest
Thanks
Watch these sessions for Coach _Mahmoud_Ayman
then you can Solve from CSES Problem Set DP Section and you can solve DP Sheets on this Group
Thx for sharing
Try Vivek Gupta's DP workshop on YT and then try solving CSES problems (you can skip the last 2-3 for now). And try to solve more and more DP problems from CodeForces
Yes this helped me. And adding to that try atcoder educational dp contest
There is a specific AtCoder contest for exactly that theme
And here is the editorial
Hope that it will help you a lot!
Ok, I will try to solve.
Learn from Aditya Verma DP from Youtube
Thanks
Learn from Takeuforward on Youtube. I think that's enough to build strong foundation in DP.
This magic stuff had me doubting if a gm was really asking this.
What do you mean pls?
I think DP is something that comes with experience. You don’t have to learn everything at once, but at the beginning you should learn some basic stuff and understand the right way to think.( by solving more)
If possible try to learn iterative DP first. You can also follow this problem set,it’s more than enough to master DP: list
Thx bro
When I see a problem I always try to find greedy approach first. I give 5min to think for any greedy approach and I think if I am progressing with any idea I continue else move to DP. Now in Dp you have basic Dp which are 1D,2D,3D,partition,LCS,LIS etc.. Then I learned bitmask and digitdp. Honestly Bitmask is very helpful in cf while digitdp is good for recent leetcode contest. Then extend it with exclusion-inclusion and problems that are mix of dp + e/i (here bitmask dp comes too alot). Then I think most important thing is some questions are greedy+dp. I don't know if thats how I should call them but there are certain things better so we use that fact in dp and optimize. Also prefix calculation of previous iteration to optimize solution is also one. Also sometimes you will think that your current dp is TLE/MLE but actually you will not visit all states so you can use map<> and memoization to solve those. I think in the end alot depends on how to optimize further in hard questions.
Thank you for taking the time to share your experience and insights. Your explanation really helped me see the bigger picture of how to approach DP problems, especially the balance between greedy thinking, core DP patterns, and optimization. I really appreciate it.
Solve problems
Can you give me a list of nice problems?
I can confirm that this works.
Practice DP problems, consider them thoroughly. Solve the same problem in recursive, iterative tables approaches