From 1a3bdda8270b3a2b06fc3be6778925301563dd70 Mon Sep 17 00:00:00 2001 From: Anna Schiedner Date: Thu, 21 Apr 2022 18:37:52 +0200 Subject: [PATCH] =?UTF-8?q?removeLast=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ArrayManipulation.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ArrayManipulation.java b/ArrayManipulation.java index b72ab02..08785ad 100644 --- a/ArrayManipulation.java +++ b/ArrayManipulation.java @@ -26,4 +26,11 @@ public class ArrayManipulation { } return newArray; } + public static int[] removeLast(int[] arr) { + int[] result = new int[arr.length-1]; + for (int i = 0; i < arr.length-1; i++) { + result[i] = arr[i]; + } + return result; + } }