title: Number of pairs of pairs with difference between first elements less than or equal to minimum of the second elements
body: <p>Given an array of integer pairs <code>pair&lt;int,int&gt;</code>, it is required to find number of pairs of <code>pair&lt;&gt;</code> such that the absolute difference between the first elements of the pairs is less than or equal to the minimum of the second elements of the pairs.  </p>
  
  <p>Eg:  </p>
  
  <pre><code>Pair 1: 2,5
  Pair 2: 7,4
  Since (7-2) &lt;= min(5,4) it is a valid pair
  </code></pre>
  
  <p>PS: I was expecting a better time complexity than the naive <code>O(N*N)</code>.</p>