title: Run time complexity for Two for loops in One for loop
body: <p>I am writing a java method that finds the stability indexes for an array. My algorithm works fine but I am unsure of its run time complexity. I believe it is O(n) since the first loop is O(n) and the two inner loops are O(2n), but again I'm not sure.</p>
  
  <pre><code>int[] arr = {0, -3, 5, -4, -2, 3, 1, 0};
  
  for(int num = 0; num &lt; arr.length; num++){
      int sumLeft= 0;
      int sumRight = 0;
      for(int i = 0; i&lt;num; i++){
          sumLeft= sumLeft + arr[i];
      }
      for(int i = num + 1; i &lt; arr.length;i++){
          sumRight= sumRight + arr[i];
      }
      if(sumLeft==sumRight){
          System.out.println(num);
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>0
  3
  7
  </code></pre>