Question: java getLongestRun question public class A1Q3 { /** * Returns the longest run of consecutive identical elements in elems. * We assume that the list
java getLongestRun question
public class A1Q3 { /** * Returns the longest run of consecutive identical elements in elems. * We assume that the list is not null. * * @param elems the list of integers * @return size of the longest run */ private static int getLongestRun(int[] elems) { // REPLACE THE BODY OF THIS METHOD WITH YOUR OWN IMPLEMENTATION } /** * The main method of this program. Gets an array of * strings as input parameter. The array is assumed to * be non-null, and all the strings in the array are * parsable as integer. * * The function prints out the longest run of consecutive * identical integers parsed in args * @param args space-separated list of strings parsable as integers */ public static void main(String[] args) { // REPLACE THE BODY OF THIS METHOD WITH YOUR OWN IMPLEMENTATION } } example;
> java A1Q3 0 > java A1Q3 0 1 1 0 3 2 > java A1Q3 0 1 0 3 1 > java A1Q3 0 1 0 3 4 4 4 4 0 0 4 > java A1Q3 1 1 2 3 3 3 3 3 6 5 5 > java A1Q3 6 6 7 1 1 1 1 4 1 4 > java A1Q3 6 2 4 8 6 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
