Count the number of spikes

Company: IBM sde

Difficulty: medium