Question: /* * Input Parameters: * - `seq`: a non-empty array of integers * * Assumptions: * - Input array `seq` is not empty. * *
/* * Input Parameters: * - `seq`: a non-empty array of integers * * Assumptions: * - Input array `seq` is not empty. * * What to return? * - Return another array of strings, each of which denoting a non-empty suffix of the input array. * * A suffix of array `seq` contains its last n elements (where 1 <= n <= seq.length). * * For example, if the input array is: * * <3, 1, 4> * * Then the output or returned array of string values is: * * <"[3, 1, 4]", "[1, 4]", "[4]"> * * where each suffix is structured as a comma-separated list surrounded by square brackets. * * Note that the length of the output array is equal to the length of the input array. * * Also, elements in the output array are ``sorted'' by the lengths of the suffixes. * (e.g,. the last element is the suffix of length 1, the second last element is the suffix of length 2). * * See the JUnit tests related to this method. */ public static String[] task1(int[] seq) { String[] 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
