mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
14 lines
549 B
HTML
14 lines
549 B
HTML
<p>在一个整数数组中,“峰”是大于或等于相邻整数的元素,相应地,“谷”是小于或等于相邻整数的元素。例如,在数组{5, 8, 4, 2, 3, 4, 6}中,{8, 6}是峰, {5, 2}是谷。现在给定一个整数数组,将该数组按峰与谷的交替顺序排序。</p>
|
|
|
|
<p><strong>示例:</strong></p>
|
|
|
|
<pre><strong>输入: </strong>[5, 3, 1, 2, 3]
|
|
<strong>输出:</strong> [5, 1, 3, 2, 3]
|
|
</pre>
|
|
|
|
<p><strong>提示:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>nums.length <= 10000</code></li>
|
|
</ul>
|