原题链接:https://oj.leetcode.com/problems/find-peak-element/
题目大意:给定一个相邻元素不相等的数组,找出其中的一个局部最大值,返回对应下标。
方法1:顺序遍历。
本题的一个重要特点是,从第一个元素开始,若其大于相邻的后续元素,则第一个元素就是一个局部最大值,返回即可。若其小于相邻的后续元素,则第二个元素大于第一个元素。如此,一一遍历数组,...
分类:
其他好文 时间:
2014-12-15 15:29:53
阅读次数:
112
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index...
分类:
其他好文 时间:
2014-12-10 08:07:22
阅读次数:
165
A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index....
分类:
其他好文 时间:
2014-12-10 07:03:49
阅读次数:
221
A peak element is an element that is greater than its neighbors.
Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.
The array may contain multiple peaks, in ...
分类:
其他好文 时间:
2014-12-08 21:25:17
阅读次数:
177
A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index....
分类:
其他好文 时间:
2014-12-08 21:07:19
阅读次数:
112
A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index....
分类:
其他好文 时间:
2014-12-08 19:14:44
阅读次数:
127
题目地址:https://oj.leetcode.com/problems/find-peak-element/题目内容:A peak element is an element that is greater than its neighbors.Given an input array wher...
分类:
其他好文 时间:
2014-12-08 17:37:32
阅读次数:
114
A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index....
分类:
其他好文 时间:
2014-12-06 14:05:12
阅读次数:
150
Find Peak ElementA peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and ...
分类:
其他好文 时间:
2014-12-05 23:55:39
阅读次数:
220
A peak element is an element that is greater than its neighbors.
Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.
You may imagine that num[-1] = num[n] = -∞.
...
分类:
其他好文 时间:
2014-12-05 21:25:52
阅读次数:
198