title: Algorithm confusion in codewars
body: <p>So here is the problem:</p>
  
  <p>The new "Avengers" movie has just been released! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 dollars bill. A "Avengers" ticket costs 25 dollars.</p>
  
  <p>Vasya is currently working as a clerk. He wants to sell a ticket to every single person in this line.</p>
  
  <p>Can Vasya sell a ticket to each person and give the change if he initially has no money and sells the tickets strictly in the order people follow in the line?</p>
  
  <p>Return YES, if Vasya can sell a ticket to each person and give the change. Otherwise return NO.</p>
  
  <p>My code:</p>
  
  <pre><code>function tickets(peopleInLine) {
    var speakVasya = "";
    var vasyaValue = 0;
    for (var i = 0; i &lt; peopleInLine.length; i++) {
      if (peopleInLine[i] - 25 &gt; vasyaValue) {
        speakVasya = "NO";
        break;
      } else {
        vasyaValue += 25;
        speakVasya = "YES";
      }
    }
    document.write(speakVasya);
  }
  
  
  tickets([25, 25, 50]);
  </code></pre>
  
  <p>Live demo here 
  <a href="https://jsfiddle.net/py234z11/1/" rel="nofollow">https://jsfiddle.net/py234z11/1/</a></p>
  
  <p>My problem is, according to codewars,my solution passes 7 tests but fails at 2, but i can't understand which ones as it doesn't give the arguements which puts in tickets function. </p>