```
//move zeroes: partition method: O(n)
class Solution {
public:
void moveZeroes(vector<int>& nums) {
if (nums.size() == 0 || nums.size() == 1) return;
int nonZeroPartitions = 0;
for (int i = 0; i < nums.size(); i++) {
if (nums[i] != 0) {
int tmp = nums[nonZeroPartitions];
nums[nonZeroPartitions] = nums[i];
nums[i] = tmp;
nonZeroPartitions++;
}
}
}
};
```