Здравейте.
Не мога да се оправя със задача но.12 от допълнителните материали за изпита на 22ри.
Description
Write a method that returns the index of the first element in array that is larger than its neighbors, or -1
, if there is no such element.
Input
- On the first line you will receive the number N - the size of the array
- On the second line you will receive N numbers separated by spaces - the array
Output
- Print the index of the first element that is larger than its neighbors or
-1
if none are
Constraints
- 1 <= N <= 1024
Sample tests
Input:
6
-26 -25 -28 31 2 27
Output:
1
Линк към задачата:
https://learn.telerikacademy.com/mod/page/view.php?id=8822
Линк към кода ми засега:
Благодаря.