@@ -0,0 +1,776 @@
+package com.pengyifan.leetcode;%0A%0A/**%0A * Given an array nums, write a function to move all 0's to the end of it while maintaining the%0A * relative order of the non-zero elements.%0A * %3Cp%3E%0A * For example, given nums = %5B0, 1, 0, 3, 12%5D, after calling your function, nums should be %5B1, 3,%0A * 12, 0, 0%5D.%0A * %3Cp%3E%0A * Note:%0A * %3Cp%3E%0A * You must do this in-place without making a copy of the array.%0A * Minimize the total number of operations.%0A */%0Apublic class MoveZeroes %7B%0A  public void moveZeroes(int%5B%5D nums) %7B%0A    int begin = 0;%0A    int i = 0;%0A%0A    while (i %3C nums.length) %7B%0A      if (nums%5Bi%5D == 0) %7B%0A        i++;%0A      %7D else %7B%0A        nums%5Bbegin%5D = nums%5Bi%5D;%0A        begin++;%0A        i++;%0A      %7D%0A    %7D%0A%0A    while (begin %3C nums.length) %7B%0A      nums%5Bbegin%5D = 0;%0A      begin++;%0A    %7D%0A  %7D%0A%7D%0A

Move zeroes