1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/调整数组顺序使奇数位于偶数前面 [diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof].html
2022-03-29 12:43:11 +08:00

20 lines
556 B
HTML

<p>输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有奇数在数组的前半部分,所有偶数在数组的后半部分。</p>
<p>&nbsp;</p>
<p><strong>示例:</strong></p>
<pre>
<strong>输入:</strong>nums =&nbsp;[1,2,3,4]
<strong>输出:</strong>[1,3,2,4]
<strong>注:</strong>[3,1,2,4] 也是正确的答案之一。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ol>
<li><code>0 &lt;= nums.length &lt;= 50000</code></li>
<li><code>0 &lt;= nums[i] &lt;= 10000</code></li>
</ol>