I have solved this problem, which is a simple dp. and there is an alternate version of this problem, here, with higher constraints. and i have to come to know that there exists a O(k*k) solution, with sorting of the given points. and then using LIS of the points to minimise the distance covered. Can anyone give me some hints for the O(k*k) implementation. thanks :)