Question: quick, in java please thank you Input Parameters: Cena : an array of integers that stores the following encoding: Element at each odd index (e.g.,

 quick, in java please thank you Input Parameters: Cena : an

quick, in java please thank you

Input Parameters: Cena : an array of integers that stores the following encoding: Element at each odd index (e.g., at index 1, at index 3, and so on) specifies how many times the element at the previous even index (e.g., at index , at index 2, and so on) should repeat. For example, input sequence {2, 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. Assumptions: Input array sa is not empty and contains at least one element. * What to return? - Return an array that decodes the input array. e.g., Say sea is {2, 4, 1, 3}. Then the method should return an array {2, 2, 2, 2, 1, 1, 1}. See the Junit tests related to this method. public static int[] tasks(int[] seq) { Input Parameters: Cena : an array of integers that stores the following encoding: Element at each odd index (e.g., at index 1, at index 3, and so on) specifies how many times the element at the previous even index (e.g., at index , at index 2, and so on) should repeat. For example, input sequence {2, 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. Assumptions: Input array sa is not empty and contains at least one element. * What to return? - Return an array that decodes the input array. e.g., Say sea is {2, 4, 1, 3}. Then the method should return an array {2, 2, 2, 2, 1, 1, 1}. See the Junit tests related to this method. public static int[] tasks(int[] seq) {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!