title: Optimal Selection in Ruby
body: <p>Given an array of values,</p>
  
  <pre><code>arr = [8,10,4,5,3,7,6,0,1,9,13,2]
  </code></pre>
  
  <p><code>X</code> is an array of values can be chosen at a time where <code>X.length != 0</code> and <code>X.length &lt; arr.length</code></p>
  
  <p>The chosen values are then fed into a function, score(), which will return a score based on the array of select values.</p>
  
  <pre><code>Example 1: 
  X = [8]
  score(X) = 71
  
  Example 2:
  X = [4]
  score(X) = 36
  
  Example 3:
  X = [8,10,7]
  score(X) = 51
  
  Example 4:
  X = [5,9,0]
  score(X) = 4
  </code></pre>
  
  <p>The function score() here is a blackbox and we can't modify how the function works, we just provide an input and the function will return the score output.</p>
  
  <p>My problem: How to get the lowest score for each set of numbers?</p>
  
  <p>Meaning, if X is an array that has only 1 value, and I feed all the different values in arr, each value will return me a different score value, and I find which arr value provides the lowest score.</p>
  
  <p>If X is an array of 3 values, I feed a combination of all the different possible values in arr, with each different set of 3 values returning a different score and finding the lowest score.</p>
  
  <p>This is simple enough to do if my arr is small. However if I have an array of 50 or even 100 values, how can I create an algorithm that would provide the lowest score based on the number of input values</p>