title: Wonder how codility.com test cases are defined?
body: <p>I was giving codility.com a try. For the test "PermMissingElem" on <a href="https://codility.com/programmers/lessons/1" rel="nofollow">https://codility.com/programmers/lessons/1</a> </p>
  
  <p>I wrote a PHP solution which is not very nice, but still works for all my test cases.</p>
  
  <p>Codility only gives me 20% telling me about several test cases that failed. Here are some of them. </p>
  
  <p>For example:<br/>
  <strong>empty_and_single</strong><br> 
  empty list and single element   0.050 s.    RUNTIME ERROR 
  tested program terminated unexpectedly
  stdout:
  Invalid result type, int expected.<br><br></p>
  
  <p><strong>missing_first_or_last</strong><br> 
  the first or the last element is missing    0.050 s.    RUNTIME ERROR 
  tested program terminated unexpectedly
  stdout:
  Invalid result type, int expected.<br><br></p>
  
  <p><strong>single</strong><br> 
  single element  0.050 s.    RUNTIME ERROR 
  tested program terminated unexpectedly
  stdout:
  Invalid result type, int expected.</p>
  
  <p>I know this test has been solved here before I just wonder what exactly their tests mean and why my solution fails on them. </p>
  
  <p>Here is my solution PHP code:</p>
  
  <pre><code>function solution($A) {
      $noe = count($A);
      if($noe == 0)
          return 1;
      for($i=1;$i&lt;=$noe;$i++)
      {
          if(!in_array($i,$A,TRUE))
              return $i;
      }
  }
  </code></pre>