DP approach to solve Chef and Segments in O(n^2) time..

Hello everyone…
I’ve devised an algorithm with the aid of dynamic programming for chef and segments problem of july long challenge… it is of O(n^2) time complexity… I made a series of videos that consists of my explanation of how my algorithm works… However i used a little bit of backtracking while i was coding during the contest…
But then after i realized that it could be done with DP alone… I’ve coded it in C language… and the longest task took just 0.08 sec…

Here you could find the link for my youtube channel…where you could find 15 videos namely csg1, csg2, csg3,…, csg14, csg15.

I should’ve have made this video beforehand… but i didn’t have enough karma… I asked some of my frnds to upvote my comments to get my karma points be raised… As i attained enough karma points… I’ve made this video now…

https://www.youtube.com/channel/UCnj_5gFAo9pBPduIAppgQBw
(open this link in new tab)

and this is my code… https://www.codechef.com/viewsolution/10783875

Note: I’ve made the videos with the resolution of 240p… so, you should have streamed these on youtube with atleast 240P speed…

Thanks all…

1 Like