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
Get step-by-step solutions from verified subject matter experts
