Browse Source

RemoveLast

master
Florentin Koepff 3 years ago
parent
commit
44afb413c1
  1. 16
      ArrayManipulation.java

16
ArrayManipulation.java

@ -26,6 +26,19 @@ public class ArrayManipulation {
}
return result;
}
public static int[] removeLast(int[] arr) {
int[] result = new int[arr.length - 1];
for (int i = 0; i < arr.length; i++) {
if (i == arr.length){continue;}
result[i - 1] = arr[i];
}
return result;
}
public static void main(String[] args) {
@ -36,5 +49,4 @@ public class ArrayManipulation {
}
// hallo
}
Loading…
Cancel
Save