why i am unable to write about myself in the D.P???
no spam ❌❌
Answers
You are not giving sufficient time to think about the solution . Dp is all about learning how to make dp states and optimise them . I believe that directly jumping to tough dp question will demotivate you at the present stage.
1 .Start with easiest questions , maybe the standard dp variants like lcs , lis , knapsack.
2. Pick up a notebook and try to write recursive state for the question. (Yeah , RECURSIVE ! its easier to think and it can truly improve your dp . Not only DP , but thinking recursively improves your way of thinking i believe ) then cođe the final top to bottom solution and get AC !
3. Once you solve the problem , try to convert that recursive state to derive a bottom up solution . Còde it and get AC. Refer to this Michal Danilák's answer to Are there any good resources or tutorials for dynamic programming besides the TopCođer tutorial?
4. Go slow , this approach will take time but you will be able to see the improvement yourself.
5. Never be afraid of looking at editorial (once you have tried hard enough ).Cođe the editorial solutíon by yourself after understanding it completely. Now think of similar ideas (if there can be an another solution ).
6. Move up in difficulty step by step . you can refer A2 Onļine Judge for a large collection of dp questions , sort them on basis of difficulty and start with level 1. And after all Practise is the key , the more you solve the more you learn about different type of states and its variants .
I believe that giving sufficient time to think for a soļution or even understanding it clearly from editorials will improve you significantly.
ㅤㅤㅤㅤㅤㅤㅤㅤOR
The FAST Method is an acronym for the 4 steps you need to solve any dynamic programming problem:
- Find the First Solution.
- Analyze the First Solution.
- Identify the Subproblems.
- Turn around the solution