I am trying hard to be a good programer.i solved many problems at differentes platforms like hakerearth,hakerrank,codeforces,codechef and spoj.
now i am trying to learn #dynamic_prgraming but i can’t even solve a single problem of DP. pls gys shere some good resorses which can help me to overcome.
i feel stuck now at this point to improve my skill,plese help gys.
so that i can continue…
Bro DP takes around 6 months to get good at it …so if you are not able to solve any problems right now then don’t think that you are the only one who is facing this … Keep trying hard
We all face this dp is a hard nut to crack.I would recommmend to first master recursion before jumping into solving dp because recursion is the first step for dp(not always but it gives you a great start).
After that try to understand why do we use dp.For understanding the underlying reason i will be sharing links of few videos which really helped me to think why to use dp.
watch this video to understand how or why dp is used.
And if you think you cant write recursive definition of a program like subset sum or coin change or minimum jumps to reach till end i would recommend you to learn recursion first.
Thanks!
You will be decent at it if you will solve these problems.
This assumes you have solved basic segment tree ques ( range sum query, range min query etc).
This is not how segment tree works
See 2-3 videos on youtube about segment tree.
Just pick an easy problem, Copy paste code of segment tree from any resource, try editing it and get an AC (Don’t try to go in depth about how is this working). You’ll need lots of efforts for it. Do this for 2-3 easy problems. Then “try” understanding each and every line of code of segment tree. And then solve the problems given by me.
Even I am feeling the same but I am starting to realise that there is much more to learn. I know that feeling of “want to but can’t solve problems related to dp(maybe some of them)” (in my case even other topics like recursion)… What I am doing to overcome is I am practicing some problems related to dp(or any other topic) and just move on to learn different topics from here
I am doing this because I think rather than perfecting a single topic in few weeks, perfecting many topics in few months is far better. And this frustration of wanting to solve moderate to hard problem is normal for beginners (few months in cp) I guess.
My icpc team name is " dp_nahi_aati " XD
Dp is the toughest topic in CP IMO.
It needs lots of practice to be decent at it. Don’t lose hopes, you’ll need time to be good at it. Upsolve problems which you can’t solve during contest.
PS: Is still struggle a lot at DP problems.
yup i too get frustrated sometimes but when i look back 1 year back when i just started coding and could’nt even write a bubble sort program and today i can solve dp,trees,graphs ,heap i think eventually one day i would get better at this.Even though i am an ece student not cse and
This is better than my strategy. I just picked Sereja and Brackets of cf and tried to solve it for 2-3 days which was quite frustrating, but when I got AC, it was worth it and felt very rewarding.
I think there is no definition to a “good” programmer. You are “good” (based on stars) for me while for you maybe l_returns is “good”.
After all, CP is quite an unsatisfying sport.
So please do not quit. I think if someone can can do something easily, there would be no fun and learning at all.
Getting stuck somewhere and then after doing what you are doing now and then someday looking back and laughing at the past version of yourself and realizing how much you have improved, this is what makes CP worth doing for me.
I’ve solved the last two problems you mentioned. They are Segment Tree + Lazy Propagation . I know segment tree but i sometimes get stuck in lazy propagation implementation
Lazy propagation is just extension of segment tree, Just add one lazy tree.
I don’t remember good examples for lazy propagation right now. Will share here if I can find them.