Question: Fill an integer array with 2 0 random values from 1 to 1 0 . Display the array. If the array has duplicate values adjacent

Fill an integer array with 20 random values from 1 to 10. Display the array. If the array has duplicate values adjacent to each other (i.e. the same value twice in a row), output the indices of the duplicates. If there are multiple adjacent duplicates, output the indices of the first pair. If there are no adjacent duplicates, say so. For example, ~/workspace$ java FindAdjacentDuplicates
The array is:
[1,5,6,6,5,9,8,8,3,4,3,6,8,3,1,10,3,6,4,2]
Adjacent duplicates at indices 2 and 3

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!