mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
20 lines
556 B
HTML
20 lines
556 B
HTML
<p>输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有奇数在数组的前半部分,所有偶数在数组的后半部分。</p>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>示例:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入:</strong>nums = [1,2,3,4]
|
|
<strong>输出:</strong>[1,3,2,4]
|
|
<strong>注:</strong>[3,1,2,4] 也是正确的答案之一。</pre>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>提示:</strong></p>
|
|
|
|
<ol>
|
|
<li><code>0 <= nums.length <= 50000</code></li>
|
|
<li><code>0 <= nums[i] <= 10000</code></li>
|
|
</ol>
|