Problem library

Latency Spikes

Easy
arrays

pings lists a player's ping in milliseconds, one reading per second. A reading is a *spike* if it is strictly greater than the reading right before it and strictly greater than the reading right after it. The first and last readings can never be spikes.

Return how many spikes there are.

Examples

Input: pings = [40,90,45,45,120,60]
Output: 2
Input: pings = [30,30,30]
Output: 0