why in second problem when s[i] = 'h' then dp[i][1] = min(dp[i-1][1], dp[i-1][0])/ i think that dp[i-1][1] < dp[i-1][0] because [1] we not delete and so we dont get point, but in dp[i-1][0] we delete 'h' so we get some poits for it and so should be true this dp[i-1][1] < dp[i-1][0] . where the problem
Bro thik a case where until index i we got x number of 'a' for making dp[i][1]= only 'h' we have to delete all 'a' them now at index i we have 'h' dp[i][0] tell us until index i we are deleted 'h' value is dp[i][0] . That tells us if we have "hhaaaa" cost(h)< cost(a) then deleting a is more beneficial than deleting 'h' thats why we are taking minimum of both according to me
Such a great stream. Please keep up the good work.
Again, great content brother. Keep this going.
you are a good teacher, greate videos
Great content man , keep growing 🎉❤❤❤
Thanks! Sure
Great Content!! Do streams on segment trees.
Loved this one, onto the next 🚴
Nice!
I think Trees then range-queries after graph would be great :)
thanks for video Shayan
Welcome
after dp streams do streams of segement tree with all patterns
Sure
will have topic 4 ?
Sir please one more video for DP
One request, In every video please dry run at least one test case.
why in second problem when s[i] = 'h' then dp[i][1] = min(dp[i-1][1], dp[i-1][0])/ i think that dp[i-1][1] < dp[i-1][0] because [1] we not delete and so we dont get point, but in dp[i-1][0] we delete 'h' so we get some poits for it and so should be true this dp[i-1][1] < dp[i-1][0] . where the problem
Bro thik a case where until index i we got x number of 'a' for making dp[i][1]= only 'h' we have to delete all 'a' them now at index i we have 'h' dp[i][0] tell us until index i we are deleted 'h' value is dp[i][0] . That tells us if we have "hhaaaa" cost(h)< cost(a) then deleting a is more beneficial than deleting 'h' thats why we are taking minimum of both according to me
in the 4th problem if I am changing the order of taking max dp[c[i]] , i am getting a different answer , any thoughts on that?
Also where is the case that the first ball should be taken with a*v[i] being handled here?
Graphs after this if possible