Package g0201_0300.s0283_move_zeroes
Class Solution
java.lang.Object
g0201_0300.s0283_move_zeroes.Solution
283 - Move Zeroes.<p>Easy</p>
<p>Given an integer array <code>nums</code>, move all <code>0</code>’s to the end of it while maintaining the relative order of the non-zero elements.</p>
<p><strong>Note</strong> that you must do this in-place without making a copy of the array.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> nums = [0,1,0,3,12]</p>
<p><strong>Output:</strong> [1,3,12,0,0]</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> nums = [0]</p>
<p><strong>Output:</strong> [0]</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= nums.length <= 10<sup>4</sup></code></li>
<li><code>-2<sup>31</sup> <= nums[i] <= 2<sup>31</sup> - 1</code></li>
</ul>
<p><strong>Follow up:</strong> Could you minimize the total number of operations done?</p>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
moveZeroes
public void moveZeroes(int[] nums)
-