Candy





@bonsairobo
The apparent difficulty is because of the biggish number of different cases
raised by the various interconnection of hills, valleys and plateaus.By systematically writing out the cases upfront, one can reduce the
implementation difficulties significantly.
Make some initial observations:
Each kid can receive it's first candy initially 
Create a 3 column x 9 row table:
Columns will be: currentSlope, newSlope, action
Slope can have 3 different values: decreasing, flat, increasing
Pairs of slopes (currentSlope, newSlope) can have 3*3=9 different values,
hance the 9 row. 
For each slope combination write out the action that needs to be done:
Example:
currentSlope  newSlope  action
decr decr increase run length
decr flat add hill value to output, next run length is 0
decr incr add hill value to output, next run length is 1
flat decr increase run length
flat flat run length is 0
flat incr increase run length
incr decr first half of hill length computed, next run length is 1
incr incr increase run length
incr flat add run length to output, next run length is 0
