title: Count the number of times values change in a series
body: <p>Consider the series:</p>
  
  <pre><code>s = [1, -1, 1, 1, 1, -1]
  </code></pre>
  
  <p>What is the most time-efficient way to count the number of times values in such series change? In this example, the answer is 3 (from 1 to -1, back to 1, and again to -1)</p>