Question: Input Parameters: sea': an array of integers indices': an array of integers (each of which may or may not be a valid index for sega)
Input Parameters: sea': an array of integers indices': an array of integers (each of which may or may not be a valid index for sega) Assumptions: ses may be empty. indices may be empty. 'indices may contain duplicates. What to return? - For each integer value in 'indices', if it is a valid index for input array sea, then use it to index into scal and include the result in the output array. For example: Say 'sea' is (23, 46, 69) and indices is {2, -1, 6, 3, 0, 2} (where indices -1 and 3 are invalid, so only indices 2, 0, 0, 2 are used) Then the method should return (69, 23, 23, 69} Note: Order of elements in the output array corresponds to the order in which valid indices in the 'indices' array are arranged. That is, the output array may be empty if the input array 'sag' is empty, or if the input array 'indices does not contain any valid indices. See the JUnit tests related to this method. */ public static int[] task1(int[] seq. Int () indices) { int[] result = null; return result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
