Move Zeroes
Difficulty: Medium
Source: LeetCode
Description
You are given an integer array nums and must move every 0 in the array to the end, without changing the relative order of the non-zero values. The rearrangement has to be performed directly on nums (in-place), and the overall extra space usage must remain O(1).
Please see full description in this link
Example
Example 1:
- Input: nums = [0, 1, 0, 3, 12]
- Output (final state of nums): [1, 3, 12, 0, 0]
- Explanation: The non-zero elements 1, 3, 12 stay in the same relative order, and both zeros are moved to the end
Code
# To be solved