title: Dynamic Programming algorithm to delete k elements in an array
body: <p>I was recently trying to solve a problem that took n sorted integers as input and we had to delete k integers from the array to maximize the minimum difference between two consecutive terms.</p>
  
  <p>Example test case:
  ARRAY: 6,7,10,13,15
  delete 2 integers.</p>
  
  <p>ANSWER: Integers deleted: 7,13</p>
  
  <p>My approach:</p>
  
  <p>Since we have to delete k integers we iterate over the array k times. In each iteration we wind the minimum difference between two consecutive terms.
  Let's say that after one iteration the pair i and i+1 have minimum difference.Then we compare the difference between i-1 and i+1 and the difference between i and i+2.
  If the first is larger then we delete the term i else we delete i+1.</p>
  
  <p>This approach is giving me a wrong answer.</p>
  
  <p>Since the constraints on n and k are low ( 1&lt;=k&lt;=n&lt;=30 ).
  I believe that the problem can be solved using dynamic programming but I do not know how to approach it.</p>
  
  <p>Any help would be nice. I do not want the code just the algorithm and how it was derived.
  Thanks in advance</p>