Пример #1
0
 public static void main(String[] args) {
   int[] A = {};
   int elem = 3;
   RemoveElement instance = new RemoveElement();
   int newLen = instance.removeElement(A, elem);
   System.out.println(newLen);
   for (int i = 0; i < newLen; i++) {
     System.out.print(String.valueOf(A[i]) + " \n".charAt(i == (newLen - 1) ? 1 : 0));
   }
 }
 public static void main(String[] args) {
   //		int[] A = {1, 3, 2, 5, 4};
   int[] A = {1};
   int elem = 1;
   RemoveElement re = new RemoveElement();
   int newLen = re.removeElement(A, elem);
   for (int i = 0; i < newLen; i++) {
     System.out.print(A[i] + " ");
   }
   System.out.println();
 }
Пример #3
0
 public static void main(String[] args) {
   RemoveElement test = new RemoveElement();
   int[] nums = {4, 5, 5};
   System.out.println(test.removeElement(nums, 5));
 }