Marks :100
: 4 | : 0
You are given a list P which contains N numbers.
The element in P are permutations of numbers from 1 to N.
Your task in to calculate the number of elements ($$$P_i$$$)($$$1 \le i \le N$$$) that satisfy the following condition such that Pi is second smallest element among the three number that is ($$$p_{i-1},P_i and P_{i+1}$$$)
The first line of input contains an integer N ($$$3 \le N \le 50$$$)
Next, the N line contains N integers ($$$P_i$$$)
For each test case print the number of elements that is the second smallest among the three
7 6 3 2 5 7 4 1
3
5 1 3 4 5 2
2
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.