Question: no library classes Input Parameters: so: a non-empty array of integers Assumptions: - Input array ang is not empty. What to return? - Return an
Input Parameters: so: a non-empty array of integers Assumptions: - Input array ang is not empty. What to return? - Return an array that represents an encoding of '899, by adopting the following principle: Element at each odd index (e.g., at index 1, at index 3, and so on) of the return array specifies how many times the element at the previous even index (e.g., at index e, at index 2, and so on) repeats in the input array asa'. For example, 12, 4, 1, 3) encodes that value 2 (at even index ) should repeat 4 times (as specified at odd index 1), and similarly, value 1 should repeat 3 times. Say scais (2, 2, 2, 2, 1, 1, 1). Then the method' should return an encoded array (2, 4, 1, 3). See the unit tests related to this method. public static int tl task2(int[] seg) { int[] result = null; // Do not modify this return statement. return results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
