dynamic programming algorithm during an interview
This question was asked to me in an interview and it embarrassingly exposed my shortcomings on dynamic programming. I will appreciate if someone can help me crack this one. Also, it would be very helpful to me (and others) if you can explain your thinking process along the way as you devise the solution as i seem to be able to understand when i see a solution which uses dynamic programming paradigm but struggle to come up with my own. 

Without further ado, here is the question i was asked.

Given an integer i and set X of k points x1, x2... xk on real line, select I points from set X so as to minimize the sum of the distance from every point in X to a point in I using Dynamic programming. 
dynamic programming algorithm during an interview
===

This question was asked to me in an interview and it embarrassingly exposed my shortcomings on dynamic programming. I will appreciate if someone can help me crack this one. Also, it would be very helpful to me (and others) if you can explain your thinking process along the way as you devise the solution as i seem to be able to understand when i see a solution which uses dynamic programming paradigm but struggle to come up with my own. 

Without further ado, here is the question i was asked.

Given an integer i and set X of k points x1, x2... xk on real line, select I points from set X so as to minimize the sum of the distance from every point in X to a point in I using Dynamic programming. 