Question: JAVA Problem: Code method that will locate the longest sequence of values that are all the same. If there are multiple groups of same values

JAVA

Problem: Code method that will locate the longest sequence of values that are all the same. If there are multiple groups of same values in the list that have the same number of items in each group, return the value of the items of the last longest run. There will always be at least one run of numbers in a test case.

Data: A list containing 0 or more values. The list will not point at null.

Output: Return the value that is in the longest run in the list.

Sample Data 1, 2, 3, 3, 3, 3, 4, 5 7, 7, 7, 7, 7, -11, -12, -3, 7, -134 2, 2, 2, 2, 3, 4, 5, 6, 9, 9, 9, 9

Sample Output 3 7 9

int go( List vals ) { // your code goes here }

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!