@@ -0,0 +1,556 @@
+package com.pengyifan.leetcode;%0A%0A/**%0A * Given an array and a value, remove all instances of that value in place and%0A * return the new length.%0A * %3Cp%3E%0A * The order of elements can be changed. It doesn't matter what you leave%0A * beyond the new length.%0A */%0Apublic class RemoveElement %7B%0A%0A  public int removeElement(int%5B%5D A, int elem) %7B%0A    if (A == null %7C%7C A.length == 0) %7B%0A      return 0;%0A    %7D%0A    int length = 0;%0A    for(int i=0 ;i%3CA.length; i++) %7B%0A      if (A%5Bi%5D != elem) %7B%0A        A%5Blength%5D = A%5Bi%5D;%0A        length++;%0A      %7D%0A    %7D%0A    return length;%0A  %7D%0A%7D%0A

remove element