Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

int findPeakElement(int num[], int n) { int *tmp, i; tmp = (int*)malloc(sizeof(int) * (n-1)); for(i = 0; i < n-1; ++i)tmp[i] = num[i+1] - num[i]; for(i = 0; tmp[i] > 0 && i < n-1; ++i); return i;

}

Logic is correct but does it give answer in O(log n) time ? Also , we need to use constant space ..

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.