Dsa
Two Pointers
Easy
Mountain Weather Analysis
Given a list of daily temperature readings representing a mountain's weather over a series of N days, where each temperature is an integer, your task is to determine the number of days that are classified as 'peak' days. A 'peak' day is defined as a day where the temperature is higher than the day before and the day after. Boundary days (first and last day) cannot be classified as peaks.\n\nInput Format:
- A single line containing N, followed by N space-separated integers representing the temperature readings.\n\nOutput Format:
- A single integer representing the number of peak days.\n\nExample:
Input:
5 1 3 2 4 5\nOutput:
2
(Days 3 and 4 are peaks).
Key concepts
two_pointersarrayweather
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now