title: How Codility calculates the complexity? Example: Tape-Equilibrium Codility Training
body: <p>I was training in Codility solving the first lesson: <a href="https://codility.com/demo/take-sample-test/tape_equilibrium" rel="nofollow noreferrer"><code>Tape-Equilibrium</code></a>. </p>
  
  <p>It is said it has to be of complexity O(N). Therefore I was trying to solve the problem with just one <code>for</code>. I knew how to do it with two <code>for</code> but I understood it would have implied a complexity of O(2N), therefore I skipped those solutions. </p>
  
  <p>I looked for it in Internet and of course, <a href="https://stackoverflow.com/questions/19455058/tape-equilibrium-codility-training">in SO there was an answer</a></p>
  
  <p>To my astonishment, all the solutions first calculate the sum of the elements of the vector and afterwards make the calculations. I understand this is complexity O(2N), but it gets an score of 100%. </p>
  
  <p>At this point, I think I am mistaken about my comprehension of the time complexity limits. If they ask you to get a time complexity of O(N), is it right to get O(X*N)? Being X a value not really high ? </p>
  
  <p>How does this works? </p>