Question
Given an integer array nums, move all 0‘s to the end of it while maintaining the relative order of the non-zero elements.
https://leetcode.com/problems/move-zeroes/
- Solution1
1 | class Solution { |
Complexity:
Time complexity: O(n)
Space complexity: O(1)