title: How to find a dense region in a List<int>
body: <p>hi i need to find the biggest dense region in a List of values based on a given range</p>
  
  <h1>example:</h1>
  
  <pre><code>var radius =5; //Therm edited
  var list = new List&lt;int&gt;{0,1,2,3,4,5,12,15,16,22,23,24,26,27,28,29};
  
  //the following dense regions exist in the list above
  var region1 = new List&lt;int&gt; { 0, 1, 2, 3, 4, 5 };           // exist 6 times (0, 1, 2, 3, 4, 5)
  var region2 = new List&lt;int&gt; { 12, 15, 16};                  // exist 3 times (12, 15, 16)
  var region3 = new List&lt;int&gt; { 22, 23, 24, 26, 27};          // exist 1 times (22)
  var region4 = new List&lt;int&gt; { 22, 23, 24, 26, 27, 28};      // exist 1 times (23)
  var region5 = new List&lt;int&gt; { 22, 23, 24, 26, 27, 28, 29 }; // exist 3 times (24, 26, 27)
  var region6 = new List&lt;int&gt; { 23, 24, 26, 27, 28, 29 };     // exist 1 times (28)
  var region7 = new List&lt;int&gt; { 24, 26, 27, 28, 29 };         // exist 1 times (29)
  
  //var result{22,23,24,26,27,28,29}
  </code></pre>
  
  <p>the solution doesn't really need to be fast because the max number of values is 21
  is there an way to use fluent to achieve this?</p>
  
  <p>i only know how to get the closest value </p>
  
  <pre><code>int closest = list.Aggregate((x,y) =&gt; Math.Abs(x-number) &lt; Math.Abs(y-number) ? x : y);
  </code></pre>
  
  <p>and how to get values between 2 numbers</p>
  
  <pre><code>var between = list.Where(value=&gt; min &lt; value &amp;&amp; value &lt; max);
  </code></pre>
  
  <h1>Edit</h1>
  
  <p>additional information's</p>
  
  <p>Ok <strong>range</strong> is maybe the wrong therm <strong>radius</strong> would be a better word.</p>
  
  <p>I define the dense region as the largest count of all values between currenvalue-range and currenvalue + range we get the dense region</p>