mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-01 21:03:27 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
<p>A peak element is an element that is strictly greater than its neighbors.</p>
|
||||
|
||||
<p>Given an integer array <code>nums</code>, find a peak element, and return its index. If the array contains multiple peaks, return the index to <strong>any of the peaks</strong>.</p>
|
||||
<p>Given a <strong>0-indexed</strong> integer array <code>nums</code>, find a peak element, and return its index. If the array contains multiple peaks, return the index to <strong>any of the peaks</strong>.</p>
|
||||
|
||||
<p>You may imagine that <code>nums[-1] = nums[n] = -∞</code>.</p>
|
||||
<p>You may imagine that <code>nums[-1] = nums[n] = -∞</code>. In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.</p>
|
||||
|
||||
<p>You must write an algorithm that runs in <code>O(log n)</code> time.</p>
|
||||
<p>You must write an algorithm that runs in <code>O(log n)</code> time.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [1,2,3,1]
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> 3 is a peak element and your function should return the index number 2.</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [1,2,1,3,5,6,4]
|
||||
|
Reference in New Issue
Block a user