- 1. Eingabe, Druck und Zahlen
- 2. Ganzzahl und Gleitzahl
- 3. Bedingungen: Wenn-dann-sonst
- 4. Für Schleife mit Bereich
- 5. Saiten
- 6. While-Schleife
- 7. Listen
- 8. Funktionen und Rekursion
- 9. Zweidimensionale Listen (Arrays)
- 10. Sätze
- 11. Wörterbücher
- 12. JavaScript
- 13. HTML5 and CSS
- 14. Responsive Design with Bootstrap
- 15. jQuery
Ad place
Greater than neighbours
Statement
Given a list of numbers, determine and print the quantity of elements that are greater than both of their neighbors.The first and the last items of the list shouldn't be considered because they don't have two neighbors.
Advertising by Google, may be based on your interests
In all the problems input the data using input()
and print the result using print()
.
12# Read an integer:# a = int(input())XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Input:
11 2 3 4 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output:
1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Saved solutions
Tests
Input | Correct answer | |
---|---|---|
1 2 3 4 5 | 0 | |
5 4 3 2 1 | 0 | |
1 5 1 5 1 | 2 | |
5 1 5 1 5 | 1 | |
5 5 5 5 5 | 0 | |
1 1 1 5 1 | 1 | |
345354 | 0 | |
1 465 | 0 | |
4 -54643 | 0 | |
2147483647 0 1 2 3 | 0 | |
1 2 3 4 -2147483648 | 1 | |
-9 29 -100 64 26 73 -96 28 -92 11 -14 -86 -54 -67 | 6 | |
2147483647 0 1 0 2147483647 | 1 |