Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- function moveZeroes(&$nums) {
- $j = 0;
- for($i = 0; $i < count($nums);) {
- if ($j < count($nums)) {
- $nums[$i] = $nums[$j];
- if ($nums[$i] != 0)
- $i++;
- $j++;
- } else {
- $nums[$i] = 0;
- $i++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement