/**
 * Given an array and a value, remove all instances of that value in place and return the new length.
 * The order of elements can be changed. It doesn't matter what you leave beyond the new length.
 * Created by dgq on 15/9/24.
 */
public class Solution {
}

@@ -254,10 +254,375 @@
 ution %7B%0A
+%09public int removeElement(int%5B%5D nums, int val) %7B%0A%09%09int p=0,q=0;%0A%09%09while (q %3C nums.length)%7B%0A%09%09%09if (nums%5Bq%5D == val)%7B%0A%09%09%09%09q++;%0A%09%09%09%7D%0A%09%09%09if (q != nums.length && nums%5Bq%5D != val)%7B%0A%09%09%09%09nums%5Bp%5D = nums%5Bq%5D;%0A%09%09%09%09p++;%0A%09%09%09%09q++;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return p;%0A%09%7D%0A%0A%09public static void main(String%5B%5D args)%7B%0A%09%09int%5B%5D nums = %7B3,3%7D;%0A%09%09System.out.println(new Solution().removeElement(nums,3));%0A%09%7D%0A
 %7D%0A

complete remove elements from an array