Question: Coded in Java Please and Thank You! public static int[] task3(int[] seq, int[] indices) { int[] result = {}; return result; } Input Parameters: sed:
![Coded in Java Please and Thank You! public static int[] task3(int[]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f31d71c8f52_81766f31d715d27c.jpg)
Coded in Java Please and Thank You!
public static int[] task3(int[] seq, int[] indices) { int[] result = {}; return result; }
Input Parameters: sed: a non-empty array of integers Assumptions: Input array is not empty. * What to return? Return an array that represents an encoding of 'sa, by adopting the following principle: Element at each even index (e.g., at index 0, at index 2, and so on) of the return array specifies how many times the element at the next odd index (e.g., at index 1, at index 3, and so on) repeats in the input array sea. For example, {4, 2, 3, 1} encodes that value 2 (at odd index 1) should repeat 4 times (as specified at even index ), and similarly, value 1 should repeat 3 times. Say so is {2, 2, 2, 2, 1, 1, 1}. Then the method should return an encoded array {4, 2, 3, 1}. * See the JUnit tests related to this method. */ public static int[] task4(int[] seq) { int[] result = null; return result; } Input Parameters: sed: a non-empty array of integers Assumptions: Input array is not empty. * What to return? Return an array that represents an encoding of 'sa, by adopting the following principle: Element at each even index (e.g., at index 0, at index 2, and so on) of the return array specifies how many times the element at the next odd index (e.g., at index 1, at index 3, and so on) repeats in the input array sea. For example, {4, 2, 3, 1} encodes that value 2 (at odd index 1) should repeat 4 times (as specified at even index ), and similarly, value 1 should repeat 3 times. Say so is {2, 2, 2, 2, 1, 1, 1}. Then the method should return an encoded array {4, 2, 3, 1}. * See the JUnit tests related to this method. */ public static int[] task4(int[] seq) { 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
