-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added README.md file for Move Zeroes
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<h2><a href="https://leetcode.com/problems/move-zeroes">Move Zeroes</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><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> </p> | ||
<p><strong class="example">Example 1:</strong></p> | ||
<pre><strong>Input:</strong> nums = [0,1,0,3,12] | ||
<strong>Output:</strong> [1,3,12,0,0] | ||
</pre><p><strong class="example">Example 2:</strong></p> | ||
<pre><strong>Input:</strong> nums = [0] | ||
<strong>Output:</strong> [0] | ||
</pre> | ||
<p> </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> </p> | ||
<strong>Follow up:</strong> Could you minimize the total number of operations done? |