Question: Code two methods, findFirst and findLast , each method takes two arguments, the first argument is an integer array, the second argument is an integer

Code two methods, findFirst and findLast, each method takes two arguments, the first argument is an integer array, the second argument is an integer value, call it key.

findFirst returns the location of the first occurrence of key in the array. -1 if not found.

findLast returns the location of the last occurrence of key in the array. -1 if not found.

Now, write a main method to test both.

Submit the .java file

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 Programming Questions!