```
int findPeakElement(int* nums, int numsSize) {
int flag=1;
int i;
if (nums==NULL || numsSize==0)
return -1;
for (i=1; i<numsSize; i++) {
if (flag&&nums[i]<nums[i-1])
return i-1;
flag=(nums[i]>nums[i-1]);
}
if (flag) return numsSize-1;
return -1;
}
```