python:

class Solution:
    def solve(self , a ):
        # write code here
        n=len(a);
        po=-1;
        for i in range(n):
            if i>0 and i<n-1 and a[i]>=a[i-1] and a[i]>=a[i+1]:
                po=i;
            elif i==0 and a[i]>a[i+1]:
                po=i;
            elif i==n-1 and a[i]>=a[i-1]:
                po=i;
        return po;

java:

import java.util.*;


public class Solution {
    /**
     * 寻找最后的山峰
     * @param a int整型一维数组 
     * @return int整型
     */
    public int solve (int[] a) {
        // write code here
        int n=a.length,po=-1;
        for(int i=0;i<n;++i){
            if(i==0&&a[i]>=a[i+1]){
                po=i;
            }
            else if(i==n-1&&a[i]>=a[i-1]){
                po=i;
            }
            else if(i>0&&i<n-1&&a[i]>=a[i-1]&&a[i]>=a[i+1]){
                po=i;
            }
        }
        return po;
    }
}

c++:

class Solution {
public:
    /**
     * 寻找最后的山峰
     * @param a int整型一维数组 
     * @param aLen int a数组长度
     * @return int整型
     */
    int solve(int* a, int aLen) {
        // write code here
        int po=-1;
        for(int i=0;i<aLen;++i){
            if(i>0&&i<aLen-1&&a[i]>=a[i-1]&&a[i]>=a[i+1]){
                    po=i;
            }
            if(i==aLen-1&&a[i]>=a[i-1]){
                po=i;
            }
        }
        return po;
    }
};