title: Minimal intervals between jobs
body: <p>I'm trying to solve a problem of minimizing the sum of time intervals between jobs that are given in an array. The structure of the job is as follows:</p>
  
  <pre><code>struct Job{ int start, end; };
  </code></pre>
  
  <p>and the prototype of function is:</p>
  
  <pre><code>int impatientBob(Job jobs[], int n, int k)
  </code></pre>
  
  <p>Jobs can't overlap and I have to choose k of them from array or return -1 if it's impossible. Furthermore, the array is sorted by the ending time of jobs and time is given in minutes. 
  I don't have any good idea, because I'm still quite new to dynamic programming.</p>