title: Sum of integers in an array
body: <p>So, basically, the questions asks me to find the sum of the numbers in an array. Except the number '13' is very unlucky, so it does not count '13' and the number that come immediately after a '13'.</p>
  
  <p>This is what I did:</p>
  
  <pre><code>public int sum13(int[] nums) {
    int d = 0;
    int sum = 0;
  
    for (int i=0;i&lt;nums.length;i++){
      if(nums[i] == 13){
      d = i;
      break;
      }
      else{
      d = nums.length;
      }
    }
    for(int i=0;i&lt;d;i++){
     sum = sum + nums[i];
    }
    return sum;
  }
  </code></pre>
  
  <p>Even though I pass most of the tests, I still can't understand how to exclude the number right next to the 13 from the sum.</p>
  
  <p>For example, sum13({1, 2, 2, 1, 13}) → 6 PASSES!
  sum13({13, 1, 13}) → 0 PASSES! 
  But, sum13({13, 1, 2, 13, 2, 1, 13}) → 3 RETURNS 0 instead as it stops at the first instance of 13.</p>