title: hacker rank Mini-Max Sum
body: <p><a href="https://www.hackerrank.com/challenges/mini-max-sum/problem" rel="nofollow noreferrer">this problem</a></p>
  <p>I normally erase the default code and start solving the whole thing myself. However, hackerrank test cases show a different output than the one that appears to me whenever i run against custom input. Why does it show different number?</p>
  <p>Keep in mind I have tried different input sizes as float, long long int, int, and double;</p>
  <pre><code>#include &lt;bits/stdc++.h&gt;
  
  using namespace std;
  
  int main() {
      long long int arr[5], neglect = 0, min = 9999999999999, max = 0, curr = 0; 
      for (int i = 0; i &lt; 5; i++) {
          cin &gt;&gt; arr[i];
      }
  
      while (neglect &lt; 5) {
          for (int i = 0; i &lt; 5; i++) {
              if (i == neglect) {i++;}
              curr += arr[i];
          }
          if (curr &lt; min) {min = curr;}
          if (curr &gt; max) {max = curr;}
          //cout &lt;&lt; curr &lt;&lt; endl;
          //cout &lt;&lt; curr &lt;&lt; &quot; &quot; &lt;&lt; min &lt;&lt; &quot; &quot; &lt;&lt; max &lt;&lt; endl;
          curr = 0;
          neglect++;
      }
      cout &lt;&lt; min &lt;&lt; &quot; &quot; &lt;&lt; max;
  }
  </code></pre>
  <p>All i wanted was to solve it in a way that tries all combinations then shows the least and maximum values. I know my code isn't the optimal way to solve it, I know i could just sort the array and exclude first and last elements, but please bear with me.</p>
  <p>input: <code>1 2 3 4 5</code>
  claimed output: <code>11 4198826</code></p>
  <p>but when i debugged it with the same custom input and the commented lines it showed:</p>
  <pre><code>14 14 14
  13 13 14
  12 12 14
  11 11 14
  10 10 14
  10 14
  </code></pre>
  <p>Doesn't that mean that my code should be working?</p>