IPL problem of 1D DP section in the course

my code is same as told in the hint videos, link is https://ide.codingblocks.com/s/150854