Question: Make the methods without importing anything and do not use Arraycopy(). Also run the code to make sure the output is the same and make



Make the methods without importing anything and do not use Arraycopy(). Also run the code to make sure the output is the same and make sure that there is no out of bounds errors with array's.
public static int [] [] removeDuplicates(int [][] array) It takes as input a two-dimensional array and returns a new two-dimensional array where every sequence of duplicate numbers is replaced by a single occurrence of the respective number. Keep in mind that duplicate numbers can extend in more than one rows though. public static void replaceElement(int[] [] array, int elem, int [] newElem) It takes a two-dimensional array and modifies it in-place (i.e. the method doesn't return anything). Every occurrence of elem is replaced by the items contained in newElem. The modification must happen in-place, i.e. the memory address of the whole array must remain the same; but the memory addresses of its rows can change of course. public static int [] [] smallestSubarray(int[] [] array, int sum) It takes a rectangular array and returns a square-size subarray of it whose values have a sum that is equal or larger to sum. A subarray can't be smaller than 22. If there are more than one square-size subarrays that satisfy the requirements, the method must return the square that has the smallest size. If two or more equally-sized squares satisfy the requirements, it must return the square whose values have the highest sum. Assume that the sum has such a value that always warrants a solution (i.e. no need to check or worry about this)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
