title: What BigO time complexity is my function?
body: <p>What is the BigO classification for this function?</p>
  <p>Problem definition: You have an array of integers and you want to find the largest contiguous (together in sequence) sub-sum. Find the sums of all contiguous sub-arrays and return the max.</p>
  <p>I'm still a little more than 7 months into programming, so I want to try to argue that even though there are nested loops that this function is still O(n) time complexity. The nested loops aren't going over the same data twice, they're pushing one time through a single set of data in tandem (I'm aware that I'm most likely incorrect about this). Is my intuition wrong on this? And why?</p>
  <pre><code>def largest_contiguous_sub_sum(arr)
      largest_sum = -100
  
      (0...arr.length).each do |start_idx|
          (start_idx...arr.length).each do |end_idx|
              current_sum = arr[start_idx..end_idx].sum
              largest_sum = current_sum if largest_sum &lt; current_sum
          end
      end
      largest_sum
  end
  
  arr = [2, 3, -6, 7, -6, 7] #=&gt; 8
  
  </code></pre>