Company: IBM sde
Difficulty: medium
A lab sensor records N temperature readings over time. A reading is called a spike if it is strictly greater than both its immediate neighbours. The first and last readings can never be spikes. Count the total number of spikes. Input Format: Line 1: Integer N (3 ≤ N ≤ 10^5) Line 2: N space-separated integers T[i] (-10^3 ≤ T[i] ≤ 10^3) Output Format: A single integer - number of spikes Examples: Example 1: Input: 6 1 5 2 8 3 1 Output: 2 Index 1: 5 > 1 and 5 > 2. Index 3: 8 > 2 and 8 > 3. #include <bits/stdc++.h> /* * complete the 'count_spikes' function below. * * The function is expected to return an INTEGER. * The function accepts INTEGER_ARRAY readings as parameter. */ int count_spikes(vector<int> readings) { }